Solved by ptrblck in post #2 
              
              
                The input index is directly used to index the weight matrix as seen here: 
emb = nn.Embedding(4, 2)
x = torch.arange(4)
print(emb.weight)
> Parameter containing:
tensor([[-0.5812,  0.8916],
        [ 1.9390, -0.6156],
        [ 0.2126,  0.0578],
        [-1.1099,  0.0964]], requires_grad=True)

out …