[Solved] RuntimeError: expected scalar type Long but found Float

ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index) RuntimeError: expected scalar type Long but found Float
Solution: Just convert label to torch.LongTensor.

label = label.type(torch.LongTensor)

Read More: