Skip to content Skip to sidebar Skip to footer

Should I Use Softmax As Output When Using Cross Entropy Loss In Pytorch?

I have a problem with classifying fully connected deep neural net with 2 hidden layers for MNIST dataset in pytorch. I want to use tanh as activations in both hidden layers, but in

Solution 1:

As stated in the torch.nn.CrossEntropyLoss() doc:

This criterion combines nn.LogSoftmax() and nn.NLLLoss() in one single class.

Therefore, you should not use softmax before.

Post a Comment for "Should I Use Softmax As Output When Using Cross Entropy Loss In Pytorch?"