when performing transfer learning I was using the optimizer SGD and the pre-trained network is VGG16 I got this error the code which I used was
optimizer_transfer = optim.SGD(model_transfer.fc.parameters(),lr= 0.001)
AttributeError: 'VGG' object has no attribute 'fc'
when I removed the fc from the code I get the following error
optimizer_transfer = optim.SGD(model_transfer.parameters(),lr= 0.001)
ValueError: optimizing a parameter that doesn't require gradients
These error occurs only when the I use the VGG16