Solved by NBu in post #2 
              
              
                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