RuntimeError: output with device cpu and dtype Long doesn't match the desired device cpu and dtype Float

I have copied a program from github and tried to run the code. The above error message is coming. Please help to resolve the issue.


The problem is that you provide a Tensor of type Long to a function that expects a Tensor of type Float.
You will need to look at the stack trace to know which function it is. Then you can fix this most likely by just converting the LongTensor to a FloatTensor by using .float().

1 Like

Thanks!! Problem resolved.