-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[API Compatiblity] Fix Tensor.requires_grad_ #76636
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
base: develop
Are you sure you want to change the base?
[API Compatiblity] Fix Tensor.requires_grad_ #76636
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
| self.stop_gradient = not value | ||
|
|
||
| def requires_grad_(self, value: bool) -> None: | ||
| def requires_grad_(self, requires_grad: bool = True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeHint这么写
def requires_grad_(self: Tensor, requires_grad: bool = True) -> Tensor:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1,返回值类型需要标注,怎么还给删了呢?
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #76636 +/- ##
===========================================
Coverage ? 100.00%
===========================================
Files ? 3
Lines ? 12
Branches ? 0
===========================================
Hits ? 12
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
zhwesky2010
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Category
User Experience
PR Types
Bug fixes
Description
Fix Tensor.requires_grad_