Skip to content

[optimizer] refactor SGD to use functional API#45597

Closed
wanchaol wants to merge 11 commits intogh/wanchaol/135/basefrom
gh/wanchaol/135/head
Closed

[optimizer] refactor SGD to use functional API#45597
wanchaol wants to merge 11 commits intogh/wanchaol/135/basefrom
gh/wanchaol/135/head

Conversation

@wanchaol
Copy link
Copy Markdown
Collaborator

@wanchaol wanchaol commented Sep 30, 2020

Stack from ghstack:

Differential Revision: D25932773

wanchaol added a commit that referenced this pull request Sep 30, 2020
ghstack-source-id: 5cf7399
Pull Request resolved: #45597
Comment thread torch/optim/sgd.py Outdated
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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: you can do directly d_p_list.append(p.grad)

Comment thread torch/optim/functional.py
Copy link
Copy Markdown
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

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

LGTM !

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@wanchaol merged this pull request in a0cf556.

@facebook-github-bot facebook-github-bot deleted the gh/wanchaol/135/head branch January 25, 2021 15:19
jasperzhong pushed a commit to jasperzhong/swift that referenced this pull request Nov 25, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants