a = tf.reshape(b, [1, -1])
I don't know how many columes it can be, but I only want one row. Or
a = tf.reshape(b, [-1, 3])
I don't know how many rows it can be, but I want 3 columes.
More examples for -1
>>> a = np.array([[1,2,3], [4,5,6]])
>>> np.reshape(a, (3,-1)) # the unspecified value is inferred to be 2
array([[1, 2],
[3, 4],
[5, 6]])
>>> a = np.arange(6).reshape((-1, 2))
>>> a
array([[0, 1],
[2, 3],
[4, 5]])
二维 trick
mask = tf.reshape(mask, [tf.shape(mask)[0], -1])