I want to use VGG16 network for transfer learning. Following the transfer learning tutorial 199, which is based on the Resnet network, I want to replace the lines:
model_ft = models.resnet18(pretrained=True)
num_ftrs = model_ft.fc.in_features
model_ft.fc = nn.Linear(num_ftrs, 2)
optimizer_ft = optim.SGD(model_ft.parameters(), lr=0.001, momentum=0.9)

with their equivalent for VGG16.
My attempt is:
model_ft = models.vgg16(pretrained=True)
num_ftrs = model_ft.fc.in_features
model_ft.fc = nn.Linear(num_ftrs, 2)
optimizer_ft = optim.SGD(model_ft.parameters(), lr=0.001, momentum=0.9)

where, as far as I understand, the two lines in the middle are required in order to replace the classification process (from 10 classes, to 2).  The problem is that the VGG16 class does not contain a “.fc” attribute, so running these lines results in an error.
What is the best way by which I can replace the corresponding lines in the Resnet transfer learning?
Since I am new in Pytorch (and Machine learning in general), any further (relevant) details regarding the structure of the VGG16 class (even details that are not necessarily required for the specific implementation I requested) will be gratefully appreciated.
Thanks!