Have you checked whether the shapes are what you expect at each stage in the model?
Even if the image resolution is different at validation time it shouldn’t affect the input dimension to the linear layer as there is an average pooling step after the last conv layer in ResNet-18.