I’m getting an error saying

RuntimeError: Expected object of type torch.LongTensor but found type torch.cuda.LongTensor for argument #3 'index'


Can someone tell me what it means by argument #3 "index"? I can’t find this error message either in torch.nn.modules.sparse nor https://pytorch.org/docs/0.4.0/_modules/torch/nn/functional 26.
Here is my code:
        self.network.eval()        
        batch['doc_tok']=batch['doc_tok'].long().cpu()
        batch['query_tok']=batch['query_tok'].long().cpu()
        self.network.cpu()
        
        print(batch['doc_tok'].dtype,  batch['query_tok'].dtype)

        start, end, _ = self.network(batch)

As you see, I even explicitly sent all variables to cpu to debug this error.
And batch[‘doc_tok’], batch[‘query_tok’] prints out as both torch.int64.
Here is the error I’m getting.
  File "/home/aerin/Desktop/squad_vteam/src/model.py", line 110, in adversarial_loss
    start, end, _ = self.network(batch)
  File "/home/aerin/anaconda3/envs/pytorch0.41/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/aerin/Desktop/squad_vteam/src/dreader.py", line 78, in forward
    doc_mask, query_mask = self.lexicon_encoder(batch)
  File "/home/aerin/anaconda3/envs/pytorch0.41/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/aerin/Desktop/squad_vteam/src/encoder.py", line 116, in forward
    doc_emb, query_emb = emb(doc_tok), emb(query_tok)
  File "/home/aerin/anaconda3/envs/pytorch0.41/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/aerin/anaconda3/envs/pytorch0.41/lib/python3.6/site-packages/torch/nn/modules/sparse.py", line 110, in forward
    self.norm_type, self.scale_grad_by_freq, self.sparse)
  File "/home/aerin/anaconda3/envs/pytorch0.41/lib/python3.6/site-packages/torch/nn/functional.py", line 1110, in embedding
    return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected object of type torch.LongTensor but found type torch.cuda.LongTensor for argument #3 'index'

Where should I look at to fix this error?
Any comment (even though it’s short!) or just listing keywords to look at will be highly appreciated!