It looks like in my case the issue was a corruption of the dataset, so that for some samples the target category was -1. Interestingly, when I try to replicate calling nn.CrossEntropyLoss directly on tensors on the CPU, I get an error message, if one of the targets is -1. When I run this on the GPU, I appear to get negative loss, rather than an error message.