Something seems strange in the ResNet you are using, as doing something like
resnet50 = torchvision.models.__dict__['resnet50']()
resnet50(torch.randn(24, 3, 840, 840))

should work fine.
Can you check which layer of the ResNet it fails on?