brianyu:

‘Assertion `cur_target >= 0 && cur_target < n_classes’


I also run into this error when computing a loss on GPU, but the error is "Unable to get repr for <class ‘torch.Tensor’>. After I move the prediction and truth to cpu and call the F.cross_entropy again. I see the informative error, “cur_target…”.