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

About optim #16

Open
xihuai18 opened this issue Jan 7, 2020 · 0 comments
Open

About optim #16

xihuai18 opened this issue Jan 7, 2020 · 0 comments

Comments

@xihuai18
Copy link

xihuai18 commented Jan 7, 2020

Here is a note from Pytorch document, https://pytorch.org/docs/1.2.0/optim.html#constructing-it.
If you need to move a model to GPU via .cuda(), please do so before constructing optimizers for it. Parameters of a model after .cuda() will be different objects with those before the call.

In general, you should make sure that optimized parameters live in consistent locations when optimizers are constructed and used.

I noted that you can .cuda() or .cpu() after the optimizers are constructed, but the algorithm still work. I can't figure out it.

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

1 participant