Solved by ptrblck in post #2 
              
              
                Not in the case of nn.CrossEntropyLoss or nn.NLLLoss (which are equivalent). 
If you have a look at the formula to calculate the loss, you’ll see that only the current class index is needed to get the corresponding log probability. I guess other frameworks convert the one-hot encoded vector to an in…