Question about resnet.py dimension

I’m new to PyTorch and deep learning.
While reading resnet.py code, there was a line that I couldn’t understand.

Why is fc layer not considering the size of an image?
Shouldn’t it consider not only feature size, but also width and height of output of the avgpool layer?

The avg pooling layer just before the fully connected reduces it to 1x1 image size so you dont need that

It doesn’t ensure this, you’ll have to manuualy change the fully connected if you choose other input size than 224x224

1 Like