The dimension you defined is not correct according to the example. it must be 1-dimensional not 0-dimensional, so for accessing one dimension it is correct way to call “item” method
c = torch.tensor([1, 2, 3, 4])
print (c[0].item())
print (c.ndimension())
1
1
In Case of Zero Dimension Example
c = torch.tensor(20)
print (c.ndimension())
print (c.item())