PyTorch-Tutorial
PyTorch-Tutorial copied to clipboard
Question about GAN code: update the generator while training the discriminator
Through reading ur code, I think you update the generator while training the discriminator. We should detach it while training the discriminator, right?
https://github.com/MorvanZhou/PyTorch-Tutorial/blob/master/tutorial-contents/406_GAN.py#L52-L53
opt_D = torch.optim.Adam(D.parameters(), lr=LR_D)
opt_G = torch.optim.Adam(G.parameters(), lr=LR_G)
This will update G and D separately.
Thanks man, I understand now. I got confused by comparing ur code with the DCGAN tutorial on pytorch website. Thanks again!