Do I need to apply the softmax function to my logit before calculating the CrossEntropyLoss?
Hello, I am trying to compute the CrossEntropyLoss directly by using this code:loss_fct = CrossEntropyLoss()
mc_loss = loss_fct(reshaped_logits, mc_labels)If the reshaped_logits contain the logit values before softmax, should I applynn.softmaxfunction before I doloss_fct(reshaped_logits, mc_labels)? Thank you,
2020-10-15T18:24:55Z
PyTorch CrossEntropyLoss combines softmax and the cross-entropy loss, so no.