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

[nn] add set_to_none flag for C++ optim endpoint #92989

Closed
wants to merge 2 commits into from

Conversation

janeyx99
Copy link
Contributor

@janeyx99 janeyx99 commented Jan 25, 2023

@pytorch-bot
Copy link

pytorch-bot bot commented Jan 25, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/92989

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit b74ccac:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the release notes: nn release notes category label Jan 25, 2023
janeyx99 added a commit that referenced this pull request Jan 25, 2023
ghstack-source-id: 77afd5ad165d689e1919d8d7ab1a1143c5a7d6a6
Pull Request resolved: #92989
janeyx99 added a commit that referenced this pull request Jan 25, 2023
ghstack-source-id: ca6e9ad746ce77e2d53f1e97b09371d3280eafd1
Pull Request resolved: #92989
@janeyx99 janeyx99 requested a review from ngimel January 25, 2023 23:35
if (p.grad().defined()) {
p.grad().detach_();
p.grad().zero_();
if (p.mutable_grad().defined()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why mutable_grad and not grad here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because grad() comes up with an error when using reset that it is const.

The module.cpp zero_grad equivalent also uses mutable_grad().

@janeyx99
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 26, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@facebook-github-bot facebook-github-bot deleted the gh/janeyx99/26/head branch June 8, 2023 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: nn release notes category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants