How to reshape tensors?

I need to reshape a tensor with size [12, 1, 28, 28] now I need to flatten the last two and remove the second dimension so that the shape beocmes [12, 784] #28*28 -> 784

is there similar methods like reshape() as in numpy?

a=torch.Tensor(12,1,28,28)
b=a.view(12,-1)

7 Likes