Solved by ptrblck in post #4 
              
              
                The indexing error is raised in: 
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)

so check the min and max values of input and make sure they match the weight dimension, i.e. the input should contain values in [0, num_embeddings-1]. 
Here is an example of a working an…