Please do the following
codes:
0-dim tensor
a = torch.Tensor(3)
print(a[0])
print(a[0].dim())
1-dim tensor
b = torch.Tensor(3,1)
print(b[0])
print(b[0].dim())
output:
tensor(0.)
0
tensor([ 0.])
1
I found this when I was running one of the old version pytorch tutorials with newer version of pytorch. It seems the part in the tutorial is fixed now but I am still wondering why it changes like so.