Do I need to use softmax before nn.CrossEntropyLoss()?

I am reading about the cross entropy loss http://pytorch.org/docs/master/nn.html but I am confused. Do I need to send the output of my last layer (class scores) through a softmax function when using the nn.CrossEntropyLoss or do I just send the raw output ?

3 Likes

You just send the raw output. Check out this this thread for small discussion about this topic: VGG output layer - no softmax?

2 Likes