code: def modify_resnets(model):
      # Modify attributs
      model.last_linear = model.fc
      model.fc = None
  
      def features(self, input):
          x = self.conv1(input)
          x = self.bn1(x)
          x = self.relu(x)
          x = self.maxpool(x)
  
          x = self.layer1(x)
          x = self.layer2(x)
          x = self.layer3(x)
          x = self.layer4(x)
          return x
  
      def logits(self, features):
          x = self.avgpool(features)
          x = x.view(x.size(0), -1)
          x = self.last_linear(x)
          return x
  
      def forward(self, input):
          x = self.features(input)
          x = self.logits(x)
          return x
  
      # Modify methods
      model.features = types.MethodType(features, model)
      model.logits = types.MethodType(logits, model)
      model.forward = types.MethodType(forward, model)
      return model
  
imports: from __future__ import print_function, division, absolute_import
  import torchvision.models
  import torch.utils.model_zoo
  import torch.nn.functional
  import types
  import re
label_desc: Use image node_id 11 for calling a global function with example usage: modify_resnets(model) and returns: model, x, x, x