Solved by ptrblck in post #2 
              
              
                In a classification use case you can pass the raw logits (i.e. the model output without a non-linearity) to nn.CrossEntropyLoss. Internally F.log_softmax and nn.NLLLoss is called. 
Alternatively you could add nn.LogSoftmax to out output layer and use nn.NLLLoss as the criterion. 
The underscore is u…