You can’t change the number of elements in the tensor, so you’re likely calculating the dimensions wrong. If you have a 100 element tensor, you can’t view it to x.view(20,10) because that would require you to have 20*10=200 elements. Try just taking a 100 element tensor and running x.view(1,100,1) and you’ll see how you can arbitrarily add dimensions.