If you are using nn.CrossEntropyLoss, you should directly pass the logits to this loss function, since internally nn.NLLLoss and F.log_softmax will be used.
Your proposed softmax function should not be used for one of these loss functions, but might of course be used for debugging purposes etc. to see the probabilities.