How to print more predicted categories using ResNet50

I followed the documentation here Models and pre-trained weights — Torchvision main documentation and was wondering how can we print for example the top 3 predicted categories for ResNet50?

You could use torch.topk on the model outputs and check the .indices attribute.

worked perfectly thank you!!