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
.reshape()
has been added recently to help users more used to numpy.
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
.reshape()
has been added recently to help users more used to numpy.