Hi,
When an autograd function receives an input with requires_grad=True, that mean that it will need to compute the gradients for this input.
If the function will be unable to compute these gradients (Embedding wrt the indices in this case), it will raise an error if you pass indices with requires_grad=True.
To fix this error, you just need to pass indices with requires_grad=False either by computing them using only Variables that do not require gradients or if you learn your indices in another way, use new_ind = ind.detach(). By doing so, new_ind will have requires_grad=False and no gradients will be propagated.
The Embedding layer contains internally the embedding vectors (called weights) created here 50. Parameter can be considered here as a simple Variable with requires_grad=True. So the gradients wrt the embedding vectors will always be computed.
Indeed, you can check that even if the input (indices) of your embedding layer has requires_grad=False, the output will have requires_grad=True (because gradients are needed for the embedding vectors.