Solved by eqy in post #6 
              
              
                OK, I think the issue is that the targets are supposed to be of float dtype rather than long here. Does tgts.to(torch.float) work?