Which one should I prefer?

k=torch.tensor([2,1])
print(k.size())
k= k.contiguous().view(1,2) #1
# or
k= k.reshape(1,2) #2

The one you prefer :slight_smile:
.reshape() has been added recently to help users more used to numpy.