.shape return no value. Bug or not?

The following code returns no value. Is this a bug?

lab_ = torch.tensor((2))
print("lab_.size: ",lab_.shape)

lab_.size: torch.Size([])

It is not a bug.
In python, (2) is considered as single element scalar, where as (2,) is considered as a tuple with one element (pl. note the comma inside brackets).

To get your expected output,

lab_ = torch.tensor((2,))

will print

torch.Size([1])
1 Like

can u please look at the other question I just posted