Good idea trying to run on CPU, that error gives a little more context. It sounds like your targets (that you’re passing to NLLLoss or CrossEntropyLoss) are out of bounds? What are your targets and how many classes are there?