I am training a GAN, I set_requires_grad=False for Discriminator , it will stop calculating gradients for the discriminator while update the generator.  when update the Discriminator, i set set_requires_grad=True back. It can save some time and memory.
but when i load the pre-trained Discriminator, it occurs error:
loaded state dict contains a parameter group that doesn’t match the size of optimizer’s group.
while if  set_requires_grad is always True, this error does not occur.
so how to load a pre-trainded model with set_requires_grad?