Problems on using torchvision.resnet

My ResNet is not working on some images
Here Is my probe of sizes in input layer, the layer before avgpool and the layer after avgpool.
Right1.jpg
torch.Size([1, 3, 256, 382])
torch.Size([1, 2048, 8, 12])
torch.Size([1, 2048])
Right2.jpg
torch.Size([1, 3, 256, 341])
torch.Size([1, 2048, 8, 11])
torch.Size([1, 2048])
wrong.jpg
torch.Size([1, 3, 256, 454])
torch.Size([1, 2048, 8, 15])
torch.Size([1, 4096])

It seems that the avgpool layer goes wrong.
Is there any remedies?

resnet expects input of 224x224