Skip to content

(manually) update zero gradients after updating the weights #3397

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

Closed
wants to merge 1 commit into from

Conversation

bintang-aswam
Copy link

@bintang-aswam bintang-aswam commented Jun 17, 2025

Fixes #ISSUE_NUMBER : PyTorch Docathon H1 2025 #153952

file location: https://github.com/pytorch/tutorials/blob/main/beginner_source/examples_autograd/polynomial_autograd.py

Description

Previous version:
a.grad, b.grad, c.grad, d.grad = None, None, None, None

Proposed version:
Deletion on that code snippet or at least put a comment on that code snippet. It eventually runs successfully with verified numerical outputs.

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.

Previous version:
a.grad, b.grad, c.grad, d.grad = None, None, None, None

instead it's appropriate to just set 0. instead of "None" as follows:
a.grad, b.grad, c.grad, d.grad = 0. , 0. , 0. , 0.
Copy link

pytorch-bot bot commented Jun 17, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit 02e5a75 with merge base ab2aafd (image):

NEW FAILURE - The following job has failed:

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

@bintang-aswam bintang-aswam deleted the patch-2 branch June 17, 2025 13:27
@bintang-aswam bintang-aswam restored the patch-2 branch June 17, 2025 13:37
@bintang-aswam bintang-aswam deleted the patch-2 branch June 17, 2025 13:38
@bintang-aswam bintang-aswam restored the patch-2 branch June 17, 2025 13:38
@bintang-aswam bintang-aswam deleted the patch-2 branch June 17, 2025 13:55
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.

2 participants