tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Fix backpropagation order in optimization tutorial

Open patrocinio opened this issue 1 month ago • 1 comments

Reorder optimizer.zero_grad(), loss.backward(), and optimizer.step() to match the recommended best practice documented in the tutorial.

Fixes #3507

Description

Checklist

  • [ ] The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • [ ] Only one issue is addressed in this pull request
  • [ ] Labels from the issue that this PR is fixing are added to this pull request
  • [ ] No unnecessary issues are included into this pull request.

patrocinio avatar Nov 29 '25 17:11 patrocinio