When I am trying to fit a model I am getting error : Expected object of type torch.cuda.LongTensor but found type torch.cuda.IntTensor

When I am trying to fit a model I am getting below error
RuntimeError: Expected object of type torch.cuda.LongTensor but found type torch.cuda.IntTensor for argument #2 ‘target’

Anyone please suggest how to fix this issue.

I am using fastai Version: 1.0.36.post1 and windows 10

Thanks,
Ritika

To convert the output tensor to the expected one, you can use .long() with that Tensor. That would make other Tensor type to long Tensor.

Thanks for the response @prajjwal1 . I am new to Pytorch. I am not able to understand where to make the changes.I am getting this error while fitting the model . Screenshot attached.

Can you pls suggest where to make changes?

I think the issue is with different data type of targets and predictions when passed to nll_loss. as evident from screenshot. Try using %debug to figure out where the error is happening exactly. One figured, just change the tensor type to longTensor?