[optimizer] refactor SGD to use functional API#45597
Closed
wanchaol wants to merge 11 commits intogh/wanchaol/135/basefrom
Closed
[optimizer] refactor SGD to use functional API#45597wanchaol wants to merge 11 commits intogh/wanchaol/135/basefrom
wanchaol wants to merge 11 commits intogh/wanchaol/135/basefrom
Conversation
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
This was referenced Jan 12, 2021
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
This was referenced Jan 15, 2021
[ghstack-poisoned]
This was referenced Jan 15, 2021
izdeby
approved these changes
Jan 19, 2021
Differential Revision: [D25932773](https://our.internmc.facebook.com/intern/diff/D25932773) [ghstack-poisoned]
albanD
reviewed
Jan 20, 2021
| buf = param_state['momentum_buffer'] = torch.clone(d_p).detach() | ||
| if p.grad is not None: | ||
| params_with_grad.append(p) | ||
| d_p = p.grad |
Collaborator
There was a problem hiding this comment.
nit: you can do directly d_p_list.append(p.grad)
Differential Revision: [D25932773](https://our.internmc.facebook.com/intern/diff/D25932773) [ghstack-poisoned]
Differential Revision: [D25932773](https://our.internmc.facebook.com/intern/diff/D25932773) [ghstack-poisoned]
Contributor
jasperzhong
pushed a commit
to jasperzhong/swift
that referenced
this pull request
Nov 25, 2021
ghstack-source-id: b6f7053 Pull Request resolved: pytorch/pytorch#45597
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
Summary: Pull Request resolved: pytorch#45597 Test Plan: Imported from OSS Reviewed By: izdeby Differential Revision: D25932773 Pulled By: wanchaol fbshipit-source-id: bc5f830d6812f847475b9bdcc67865d9968e3282
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
Differential Revision: D25932773