The error points to a type mismatch for the nn.Embedding
module, which expects a LongTensor
as the input, while you are apparently using a FloatTensor
, so you would need to change the dtype
of the input.
A quick solution would be to transform it via x = x.long()
.
Also note, that Variable
s are deprecated since PyTorch 0.4
, so you can use tensors now.