I have a tensor of shape (30, 116, 10), and I want to swap the first two dimensions, so that I have a tensor of shape (116, 30, 10)
(30, 116, 10)
(116, 30, 10)
I saw t
tf.transpose provides the same functionality as np.swapaxes, although in a more generalized form. In your case, you can do tf.transpose(orig_tensor, [1, 0, 2]) which would be equivalent to np.swapaxes(orig_np_array, 0, 1).
np.swapaxes
tf.transpose(orig_tensor, [1, 0, 2])
np.swapaxes(orig_np_array, 0, 1)