The nn.CrossEntropyLoss docs show the used formula and you can see that the logits are indexed by the target, so there is no need to use argmax (which would also break the computation graph if applied in the model output).