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

Unnecessary computation in backward pass #2

Open
ppwwyyxx opened this issue Mar 22, 2017 · 5 comments
Open

Unnecessary computation in backward pass #2

ppwwyyxx opened this issue Mar 22, 2017 · 5 comments

Comments

@ppwwyyxx
Copy link

ppwwyyxx commented Mar 22, 2017

In the code of WassersteinGAN, they have this line:

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

I think it means that when you train G, by default you'll compute gradients for D as well (but not updating them), and vice versa. Setting the flag to False to avoid the computation should speed up the training a lot.
I found that my tensorflow implementation runs much faster than this code, and this is probably the reason.

@eriche2016
Copy link

eriche2016 commented Mar 24, 2017

it is still very slow when turnning this flag off, donot know the reason.

@eriche2016
Copy link

I find that training this net on GPU for 1 iterations ,with batch size 64 on celeba , costs me nearly 30 seconds.

@ppwwyyxx
Copy link
Author

...That's probably your setup problem. It should be on the order of 0.4 seconds on a good GPU.

@eriche2016
Copy link

eriche2016 commented Mar 24, 2017

Hi, I use the default setup of the parameters. And my GPU has a memory of 12G. I donot know the reason why it is too slow..

@jazzsaxmafia
Copy link
Contributor

Thank you for the tip! We were not aware of that.

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

3 participants