I am quite new to pytorch, and I am going through the [transfer learning tutorials] on resnet(https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html 16), and I notice this line (which is also there in the inference mode):
outputs = model(inputs)
_, preds = torch.max(outputs, 1)

which, when I go through the docs, suggests that it is simply the max on each tensor along with the indices. So, preds just contains the indices, which indirectly represents the classes.
Now, when I look at mobilenet 4 tutorial (I adapted it to output 20 classes and retrained the final layer for feature extraction), I see the line
# The output has unnormalized scores. To get probabilities, you can run a softmax on it.
print(torch.nn.functional.softmax(output[0], dim=0))

Why is there this difference in resnet and mobilenet outputs? Strangely enough, when I simply use:
_, preds = torch.max(outputs, 1)

in my mobilenet transfer learning code, I seem to get the correct answers (i.e the classification is done correctly). So, I am now seriously confused as to why I would need the probablities as described in mobilenet, when I do not seem to need them in resnet.
Also, when I use these probabiliities via softmax and train, like so:
outputs = model(inputs)
outputs = torch.nn.functional.softmax(outputs, dim=1)
_, preds = torch.max(outputs, 1)

I get the same results as one without this softmax. so, I am not entirely sure what is the correct thing to do.
Any pointers would really help.
Thank you.