se7en:

embedding = nn.Embedding(5, 3)


No, it’s not correct. I figured it out in this way:



x = torch.tensor([3])
x
tensor([3])




x.size()
(1,)




embembedding = nn.Embedding(5, 3)
embedded = embedding(x)
embedded
tensor([[-0.3584, -0.4176,  0.1584]], grad_fn=)