[release/3.3][RMSNorm] remove invvar from rms_norm Python API return value#78578
Open
ShigureNyako wants to merge 1 commit intoPaddlePaddle:release/3.3from
Open
[release/3.3][RMSNorm] remove invvar from rms_norm Python API return value#78578ShigureNyako wants to merge 1 commit intoPaddlePaddle:release/3.3from
ShigureNyako wants to merge 1 commit intoPaddlePaddle:release/3.3from
Conversation
…Paddle#78438) * [RMSNorm] remove invvar from rms_norm Python API return value and update default eps - rms_norm now returns only `out` (Tensor) instead of `(out, invvar)` tuple - Updated return type annotation from `tuple[Tensor, Tensor]` to `Tensor` - Changed default eps from 1e-5 to 0.0 in both norm.py and ops.yaml - Updated unit tests: rms_norm_wrapper now calls _C_ops directly to preserve op-level invvar output for OpTest framework; removed invvar assertion in TestRMSNormAPI Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * default eps is none * fix ut --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
|
你的PR提交成功,感谢你对开源项目的贡献! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/3.3 #78578 +/- ##
===============================================
Coverage ? 100.00%
===============================================
Files ? 1
Lines ? 6
Branches ? 0
===============================================
Hits ? 6
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
DanielSun11
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Operator Mechanism
PR Types
Improvements
Description
paddle.nn.functional.rms_norm原来返回(out, invvar)两个 Tensor,其中invvar(每行的逆标准差)是内部中间量,对外部用户没有实际意义。为了和torch对齐,本 PR 在 Python API 层面将其隐藏,使函数只返回归一化结果out。主要改动:
python/paddle/nn/functional/norm.py:返回类型由tuple[Tensor, Tensor]改为Tensor,动态图/PIR 模式下取_C_ops.rms_norm(...)[0],静态图模式下只返回out;同时将eps默认值由1e-5改为实际计算时的数据类型的最小精度epspaddle/phi/ops/yaml/ops.yaml:同步将rms_normop 的epsilon默认值改为fp32的最小精度test/legacy_test/test_rms_norm_op.py:OpTest的python_apiwrapper 改为直接调_C_ops.rms_norm以保留 op 层双输出供框架校验;TestRMSNormAPI中移除对invvar的解包和数值断言是否引起精度变化
否
Cherry-pick of #78438 (authored by @DanielSun11) to
release/3.3.devPR:#78438