Actually, nn.Linear need a certain in_features, which is CxHxW. Now you can see H and W depend on the input resolution.
Following the document 8, AdaptivaAvgPool2d

Applies a 2D adaptive average pooling over an input signal composed of several input planes.
The output is of size H x W, for any input size. The number of output features is equal to the number of input planes.

It is used to fix in_features for any input resolution.