I need to reshape a tensor with size [3, 32] now I need to change the dimension so that the shape becomes [1, 3, 32] ?
Is there any similar method like reshape in numpy for torch tensors?
Thanks.
I need to reshape a tensor with size [3, 32] now I need to change the dimension so that the shape becomes [1, 3, 32] ?
Is there any similar method like reshape in numpy for torch tensors?
Thanks.
You can do:
x = x.view(1, 3, 32)
Thank you so much for the quick reply.
You can do: x = x.unsqueeze(0)