You could transform the linear layer to a conv layer with a spatial size of 1x1, but the in_features of the linear layer would be translated to the in_channels of the conv layer, so you wouldn’t win anything.
The usual approach to relax the size dependency is to add adaptive pooling layers after the feature extractor (conv-pool layers) in order to create a pre-defined activation output shape, which fits the in_features of the following linear layer.