I was f’tuning VGG network for style transfer (Gatys et al, 2015) and kept getting results that made no sense, so after some debugging it turned out I uploaded the weights incorrectly. Can someone point out my error, because I tried it on other models, and it seemed to work?
import vgg16
pretrained_weights = torch.load(os.path.join('pretrained_weights', 'vgg16-00b39a1b.pth'))
feature_extractor = vgg16.vgg16(pretrained=False)

for _n,par in feature_extractor.named_parameters():  
    par.requires_grad = False
    par = copy.deepcopy(pretrained_weights[_n]) 
    par = par.to(device)

vgg16 is the same vgg16.py from torchvision.models.
I believe copy.deepcopy didn’t change the parameters for some reason