Well, I’ve tried to explain this use case in my last answer.
Basically you have these options:


nn.Softmax + torch.log + nn.NLLLoss -> might be numerically unstable

nn.LogSoftmax + nn.NLLLoss -> is perfectly fine for training; to get probabilities you would have to call torch.exp on the output
raw logits + nn.CrossEntropyLoss -> also perfectly fine as it calls the second approach internally; to get probabilities you would have to call torch.softmax on the output

Note that you should not feed the probabilities (using softmax) to any loss function.