Solved by BartolomeD in post #2 
              
              
                A way to do this is to create a new model that only uses DenseNet’s features block: 
model = densenet121(pretrained=True)

class FeatureExtractor(nn.Module):
    def __init__(self):
        super(FeatureExtractor, self).__init__()
        self.features = nn.Sequential(*list(model.features.children()…