huyvnphan/PyTorch_CIFAR10

Softmax in the last layer

cijerezg opened this issue · 2 comments

Did you use a Softmax in the very last layer? I see that last layer is a fully connected (nn.Linear).

I didn't realize I just needed to apply that extra separately.

I have this problem too. I stil don't see any softmax used on the output, so I get this error when testing (and training) the pretrained network.
python train.py --test_phase 1 --pretrained 1 --classifier resnet18

The `preds` should be probabilities, but values were detected outside of [0,1] range.
which is a reasonable error. :)

this is the part of code that is problematic:

accuracy = self.accuracy(predictions, labels)

what function should be used on the output of the model ? why is this not in your codes ?