Accessing output scores instead of outputs classes


I am using a pre-trained ResNet18 model. How can I access/use the last FC-layer scores before softmax in outputs = model(inputs).

The torchvision implementation of ResNet18 doesn’t use a softmax in the module and the output will contain logits.
If you want to compute the predicted class labels, you can use preds = torch.argmax(outputs, dim=1).

1 Like