Some difference between the size=(1,) and size=(1,1)
size(N,) means that the size is 1 dimension and the number of elements is N
Size(M,N) means that the size is M*N namely the row equals M ,the col equals N,but the dimension is 2
We will show the experiment below:
i=th.randint(0,400,size=(5,1))
print(i.shape)
print(i)
i=th.randint(0,400,size=(5,))
print(i.shape)
print(i)
the result is
1.0
torch.Size([5, 1])
tensor([[189],
[385],
[281],
[123],
[369]])
torch.Size([5])
tensor([122, 341, 373, 239, 277])
we will see the result is consistent to our interpretation