Hi,
What would be n in your example, 4?
Let’s call M the maximum value you can have in your input tensor, and n the embedding dimension.
You would have to create your layer as:
x = nn.Embedding(M+1, n)

In your example, 9 seems to be the biggest value so you can do:
emb = nn.Embedding(10, 10) # M = 9 and n = 10

and to use it, just cast the input to long:
torch.tensor([6., 4., 9., 8.], requires_grad=True)

emb(t.long())

I hope I understood correctly what you are trying to do here.