How can I replace the forward method of a predefined torchvision model with my customized forward function?

In this case I just want to delete the self.avgpool, the flatten operation and the fc layer, so that the output of the model is just the [bs x 512 x 7 x 7] Featuremaps (when 3 224 224 image tensors are feeded), as you can see in the image in the appendix. But beyond this case i am interested in general how i can modify predefined torchvision models.