and I want to represent each of these numbers by n number of parameters, how do I use nn.Embedding, for this?
if I do
x = nn.Embedding(4, 10)
then x(input)
then input needs to be of type LongTensor, how do I pass input as a floating tensor and embedding would represent index so, 0th row would be for 6., 1st row would be for 4. and so on?
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:
The question I have here: what is interpretations of the 10 dimensional vectors? Why 10 dimensions? When the input feature is categorical, the interpretation is straight forward. In your case, the entire data universe is only 3 numbers. Are those categoricals represented by numbers or actual measurements?
@spanev Hi , thanks for this , i have a question here,after casting t to long type we no longer be able to backpropagate all the way through t (as casting is not differentiable), so is there any way we can do that also ? TIA.