Is there a tensorflow equivalent to np.empty?
In TF 2,
tensor = tf.reshape(tf.convert_to_tensor(()), (0, n))
worked for me.
If you're creating an empty tensor, tf.zeros
will do
>>> a = tf.zeros([0, 4])
>>> tf.concat([a, [[1, 2, 3, 4], [5, 6, 7, 8]]], axis=0)
<tf.Tensor: shape=(2, 4), dtype=float32, numpy=
array([[1., 2., 3., 4.],
[5., 6., 7., 8.]], dtype=float32)>