I suppose you could replace the AvgPool2d layer with an AdaptiveAvgPool2d layer, like this…
loaded_resnet_model.avgpool = nn.AdaptiveAvgPool2d(1)

That would allow you to use different size images, but I can’t guarantee that the models performance will not be affected for different size images.