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

Moving model.cuda before the optimizer construction #40

Merged
merged 2 commits into from
Jul 15, 2019

Conversation

LiyuanLucasLiu
Copy link
Contributor

Current version calls model.cuda() after the optimizer construction, which may result in undesired behaviors.

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.

Quote Source: PyTorch Doc

@namisan namisan merged commit dd36b75 into namisan:master Jul 15, 2019
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

Successfully merging this pull request may close these issues.

2 participants