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

zero_grad() between forward and backward passes generates error message #423

Closed
wants to merge 1 commit into from

Conversation

pierrestock
Copy link
Contributor

Summary:
Fixing the previous fix in D36067469 (56df34e).

Context regarding the execution order of backward hooks:

  • register_backward_hook has constant behaviors across tested PyTorch versions
  • register_full_backward_hook has various behaviors.

Previous fix was working for torch==1.11 but not for torch==1.8.1, hence CircleCI failures. This fix now works for both versions.

Note that register_backward_hook will be deprecated in the future by the Pytorch team.

Differential Revision: D36105357

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels May 3, 2022
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D36105357

pierrestock pushed a commit to pierrestock/opacus that referenced this pull request May 3, 2022
…ge (pytorch#423)

Summary:
Pull Request resolved: pytorch#423

Fixing the previous fix in D36067469 (pytorch@56df34e).

Context regarding the execution order of backward hooks:
- `register_backward_hook` has **constant** behaviors across tested PyTorch versions
- `register_full_backward_hook` has various behaviors.

Previous fix was working for `torch==1.11` but not for `torch==1.8.1`, hence CircleCI failures. This fix now works for **both** versions.

Note that `register_backward_hook` will be deprecated in the future by the Pytorch team.

Differential Revision: D36105357

fbshipit-source-id: d8e561836c681a47dacb363ae9d6661ea660f8b7
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D36105357

…ge (pytorch#423)

Summary:
Pull Request resolved: pytorch#423

Fixing the previous fix in D36067469 (pytorch@56df34e).

Context regarding the execution order of backward hooks:
- `register_backward_hook` has **constant** behaviors across tested PyTorch versions
- `register_full_backward_hook` has various behaviors.

Previous fix was working for `torch==1.11` but not for `torch==1.8.1`, hence CircleCI failures. This fix now works for **both** versions.

Note that `register_backward_hook` will be deprecated in the future by the Pytorch team.

Differential Revision: D36105357

fbshipit-source-id: 100e9910f2ee3b310d4b39275a3399a1d3dfa99b
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D36105357

Copy link
Contributor

@romovpa romovpa left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants