Solved by ptrblck in post #9 
              
              
                Since you are working with a ResNet, have a look at its forward. As you can see, there is unfortunately no model.features attribute, so in this case it would be easier to replace model.classifier = nn.Identity() and just call the model directly.