Below is what I did in jupyter notebook (I found this happen while running some codes sometimes though I cannot find a way to creat a 0-dim tensor myself)

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.

Assume that there is an operation of concatenating some tensor B = [b1, b2, …, bn] (bi is vector) to another tensor A. When you don’t want B, you can simply set n = 0 without checking the shape of B, if PyTorch supports 0-dim tensor correctly.