Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In DCGAN example, when training G, D is not freezed #86

Closed
fxia22 opened this issue Feb 25, 2017 · 2 comments
Closed

In DCGAN example, when training G, D is not freezed #86

fxia22 opened this issue Feb 25, 2017 · 2 comments

Comments

@fxia22
Copy link

fxia22 commented Feb 25, 2017

Unlike in GAN paper, there is no

for p in netD.parameters():
    p.requires_grad = False # to avoid computation

when updating generator. Is this on purpose or by mistake?

In @soumith's torch reference implementation, D is fixed when updating G:

   local df_do = criterion:backward(output, label)
   local df_dg = netD:updateGradInput(input, df_do)
   netG:backward(noise, df_dg)
@soumith
Copy link
Member

soumith commented Feb 26, 2017

oh, i kinda didn't do it in hindsight, I should do it.
However that will only save computation.
D is still frozen because I dont call optimizerD.step() (which is when D's parameters actually get updated)

@fxia22
Copy link
Author

fxia22 commented Feb 26, 2017

Thanks, that makes sense.

@fxia22 fxia22 closed this as completed Feb 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants