You want to get your trained model without softmax and feed it an image and get its output and apply softmax on the result, right? if so, you can use sth like: nn.Softmax()(model(image)) or F.softmax(model(image)). it will give you the probability for 8 classes.