test new unittests on develop branch#79418
Conversation
risemeup1111
left a comment
There was a problem hiding this comment.
发现一个会导致新增 UT 在 setup 阶段直接失败的阻塞问题,细节已放在行级评论中。
优先级:P3 非行级:PR 标题/描述不在 changed diff 中。当前标题和描述更像临时验证说明(“test new unittests on develop branch”),如果这个 PR 准备合入 develop,建议改成正式测试意图,例如“Add compat internal composite API tests”,并在描述里明确新增覆盖点、依赖的 compat 机制以及本地/CI 测试计划;如果只是验证用 PR,建议在描述中明确不作为正式合入内容。
|
|
||
|
|
||
| def setUpModule(): | ||
| paddle.enable_compat(level=2) |
There was a problem hiding this comment.
这里会让新增测试在模块 setup 阶段直接失败。当前 python/paddle/compat/proxy.py 中 enable_compat 的签名只有 scope/blocked_modules/backend/silent 等关键字参数,没有 level,而 test/compat/CMakeLists.txt 会通过 test_*.py glob 自动注册这个文件;因此运行该 UT 时会先抛出 TypeError: enable_compat() got an unexpected keyword argument 'level',后面的断言都不会执行。
请把 level=2 对应的 top-level paddle.* caller-aware compat 实现随这个 PR 一起引入,或者把这组测试改成当前 develop 已存在的 API 语义。示例修复方向:
# 方案一:先在实现侧支持该测试依赖的 API,并保证 level=2 会切换外部 paddle.* 表面
def enable_compat(
*,
level: int | None = None,
scope: _ScopeType = None,
blocked_modules: _ScopeType = None,
backend: Literal["torch"] = "torch",
silent: bool = False,
) -> None:
...
# 方案二:如果本 PR 只验证当前 develop,移除 level=2 假设,改用现有 paddle.compat.* / torch proxy 入口重写断言。
CI报告基于以下代码生成(30分钟更新一次): 1 Required任务 : 31/32 通过
2 失败详情🔴 Fleet Unit test (single card) — 环境问题(置信度: 高)分析器: 通用分析(fallback)
关键日志:
修复建议:
关联变更: |
risemeup1111
left a comment
There was a problem hiding this comment.
新提交已把 paddle.enable_compat(level=2) 改为当前接口支持的 paddle.enable_compat(),上一轮指出的 setup 阶段失败问题在代码层面已解决。本轮没有新增行级意见;CI 仍在运行中,建议等相关测试完成后再合入。
优先级:P3 非行级:PR 标题/描述不在 changed diff 中。标题和描述仍偏向临时验证说明(“test new unittests on develop branch”),如果这个 PR 准备正式合入,建议改成例如
[Operator Mechanism] Add compat internal composite tests,并在描述中说明当前覆盖的是enable_compat()默认 torch import proxy 下 Paddle composite API 保持 native 行为,而不是level=2/top-levelpaddle.*alias 行为。
|
/re-run all-failed |
risemeup1111
left a comment
There was a problem hiding this comment.
已复查最新提交:上一轮指出的 enable_compat(level=2) 阻塞问题仍已解决;本次变更删除了此前 CI 报告中触发 XPU 失败的 nanquantile 用例。本轮没有新增行级意见,当前 CI 还在运行中,建议等相关检查完成后再合入。
优先级:P3 非行级:PR 标题/描述不在 changed diff 中。标题和描述仍偏向临时验证说明(“test new unittests on develop branch”)。如果这个 PR 准备正式合入,建议改成例如
[Operator Mechanism] Add compat internal composite tests,并在描述中说明当前覆盖的是enable_compat()默认 torch import proxy 下 Paddle composite API 保持 native 行为。
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-07-07 15:23:16
📋 Review 摘要
PR 概述:新增 compat internal composite 回归测试,验证默认 paddle.enable_compat() 不影响 paddle.* composite 的 native 行为。
变更范围:test/compat/test_compat_internal_composites.py
影响面 Tag:Operator Mechanism
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | test/compat/test_compat_internal_composites.py:53 |
split-family 部分用 zip 比较但没有断言输出分片数量,可能漏掉少返回/多返回结果 |
📝 PR 规范检查
标题缺少来自模板枚举的 Tag,建议改为以下完整标题:
标题建议(可直接复制):
[Operator Mechanism] Add compat internal composite tests
PR 描述建议(点击展开,可直接复制)
### PR Category
Operator Mechanism
### PR Types
Not User Facing
### Description
Add compat internal composite regression tests on develop branch to verify that `paddle.enable_compat` keeps internal composite Paddle API calls on native behavior. Covered call chains include split-family APIs, quantile/sort, nan_to_num/equal/where, histogram_bin_edges/min/max, and nll_loss/equal.
related pr: https://github.com/PaddlePaddle/Paddle/pull/79391
### 是否引起精度变化
否总体评价
新增测试覆盖目标明确,但 split-family 的输出数量断言需要补强,否则测试可能漏掉分片数量错误。PR 标题/描述仍未按历史规范建议更新。
| def test_vsplit(self): | ||
| x = np.arange(48, dtype="float32").reshape([4, 4, 3]) | ||
| outs = paddle.vsplit(paddle.to_tensor(x), 2) | ||
| for o, r in zip(outs, np.array_split(x, 2, axis=0)): |
There was a problem hiding this comment.
🟡 建议 这里直接用 zip(outs, np.array_split(...)) 会截断到较短序列,缺少对返回分片数量的校验。
如果 paddle.vsplit 少返回或多返回分片,只要已有前缀内容碰巧一致,这个测试仍可能通过;hsplit 和 dsplit 里也有同样模式。
建议修复方式:先保存期望结果并断言长度,再逐项比较,例如:
expected = np.array_split(x, 2, axis=0)
self.assertEqual(len(outs), len(expected))
for o, r in zip(outs, expected):
np.testing.assert_array_equal(o.numpy(), r)|
/re-run all-failed |
1 similar comment
|
/re-run all-failed |
|
你的PR提交成功,感谢你对开源项目的贡献! |
PR Category
Operator Mechanism
PR Types
Not User Facing
Description
test if the added unittests on can pass on develop branch without patch_compat enhancement
related pr: #79391
是否引起精度变化
否