How can I copy params to the classification model from discriminator of DCGAN

I wan to copy the discriminator model of DCGAN to Classification model.

get the state_dict with model.state_dict(). It is a dictionary of parameters with names.

Now filter the weights that you want to copy from the dictionary and you can call model.load_state_dict(my_modified_dict) on your newly constructed classification model.

1 Like