[API Compatibility] Add param alias for paddle.set_rng_state#79161
[API Compatibility] Add param alias for paddle.set_rng_state#79161algorithm1832 wants to merge 2 commits into
paddle.set_rng_state#79161Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-05-27 10:30:00
📋 Review 摘要
PR 概述:为 paddle.set_rng_state 的 state_list 参数添加 new_state 别名,以提升与 PyTorch 风格 API 的兼容性。
变更范围:python/paddle/framework/random.py、test/legacy_test/test_api_compatibility_part1.py
影响面 Tag:[User Experience]
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | test/legacy_test/test_api_compatibility_part1.py:2173 |
测试仅覆盖 happy path,缺少同时传入 state_list 和 new_state 时应抛出 ValueError 的错误路径验证 |
| 📝 PR 规范 | — | 标题 Tag [API Compatibility] 不在官方枚举中 |
📝 PR 规范检查
PR 描述结构(4 个必填 section)完整合规;但标题使用的 [API Compatibility] 不在官方 Tag 枚举中。
标题建议(可直接复制):
[User Experience] Add param alias new_state for paddle.set_rng_state
总体评价
实现思路正确,param_one_alias 装饰器正确处理了别名替换和冲突检测,向后兼容。建议补充错误路径测试以增强健壮性,并修正 PR 标题 Tag。
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-05-27 10:30:00
📋 Review 摘要
PR 概述:为 paddle.set_rng_state 的 state_list 参数添加 new_state 别名,以提升与 PyTorch 风格 API 的兼容性。
变更范围:python/paddle/framework/random.py、test/legacy_test/test_api_compatibility_part1.py
影响面 Tag:[User Experience]
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | test/legacy_test/test_api_compatibility_part1.py:2173 |
测试仅覆盖 happy path,缺少同时传入 state_list 和 new_state 时应抛出 ValueError 的错误路径验证 |
| 📝 PR 规范 | — | 标题 Tag [API Compatibility] 不在官方枚举中 |
📝 PR 规范检查
PR 描述结构(4 个必填 section)完整合规;但标题使用的 [API Compatibility] 不在官方 Tag 枚举中。
标题建议(可直接复制):
[User Experience] Add param alias new_state for paddle.set_rng_state
总体评价
实现思路正确,param_one_alias 装饰器正确处理了别名替换和冲突检测,向后兼容。建议补充错误路径测试以增强健壮性,并修正 PR 标题 Tag。
| # 2. paddle-style keyword argument | ||
| paddle.set_rng_state(state_list=states) | ||
| # 3. torch-style keyword argument | ||
| paddle.set_rng_state(new_state=states) |
There was a problem hiding this comment.
🟡 建议 测试仅覆盖 happy path,缺少对冲突入参场景的错误路径验证。
当用户同时传入 state_list 和 new_state 时,param_one_alias 装饰器会抛出 ValueError,建议补充测试:
# 4. conflict: both state_list and new_state → should raise ValueError
with self.assertRaises(ValueError):
paddle.set_rng_state(state_list=states, new_state=states)
risemeup1111
left a comment
There was a problem hiding this comment.
已完成初始代码审查,未发现需要阻塞合入的问题。当前仍有部分 CI 任务在运行,建议以最终 CI 结果为准。
PR Category
User Experience
PR Types
Improvements
Description
new_statefor argstate_listinpaddle.set_rng_stateUsed AI Studio
是否引起精度变化
否