Solved by ptrblck in post #2 
              
              
                For VGG16 you would have to use model_ft.classifier. You can find the corresponding code here. 
Here is a small example how to reset the last layer. Of course you could also replace the whole classifier, if that’s what you wish. 
model = models.vgg16(pretrained=False)
model.classifier[-1] = nn.Linea…