Solved by ptrblck in post #2 
              
              
                Most likely the shape of the targets for nn.CrossEntropyLoss is wrong. 
Check the docs and the expected shape of the input and target. E.g. if you are passing class indices, make sure that the target contains the class indices (not one-hot encoded) as a LongTensor and thus does not use a “channel/cl…