How can I add simple modification for the forward method of ResNet50?

I’ve done it by following instructions in this post: How can I replace the forward method of a predefined torchvision model with my customized forward function? - #8 by Shisho_Sama