Skip to content

Conversation

@blacksheep-Aristotle
Copy link
Contributor

@blacksheep-Aristotle blacksheep-Aristotle commented Nov 26, 2025

PR Category

User Experience

PR Types

Bug fixes

Description

Fix Tensor.requires_grad_

@paddle-bot
Copy link

paddle-bot bot commented Nov 26, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@zhwesky2010 zhwesky2010 changed the title update requires_grad_ args [API Compatiblity] Fix Tensor.requires_grad_ Nov 26, 2025
self.stop_gradient = not value

def requires_grad_(self, value: bool) -> None:
def requires_grad_(self, requires_grad: bool = True):
Copy link
Contributor

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:

Copy link
Member

Choose a reason for hiding this comment

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

+1,返回值类型需要标注,怎么还给删了呢?

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@8b905d7). Learn more about missing BASE report.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zhwesky2010 zhwesky2010 requested a review from SigureMo November 27, 2025 02:53
Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

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