Skip to content

[API Compatibility] select_scatter/sgn/signbit/slice_scatter/take/tensordot/tril_indices/triu_indices/vander/logaddexp/logspace/moveaxis/nan_to_num/nanmean/nansum/masked_fill/addmv/addr/fix/histc/trunc Edit By AI Agent#79215

Merged
zhwesky2010 merged 16 commits into
PaddlePaddle:developfrom
zhwesky20:claude
Jun 8, 2026

Conversation

@zhwesky20

@zhwesky20 zhwesky20 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

PR Category

User Experience

PR Types

Improvements

Description

API Compatibility Edit By AI Agent:

  • torch.select_scatter
  • torch.Tensor.select_scatter
  • torch.sgn
  • torch.Tensor.sgn
  • torch.signbit
  • torch.Tensor.signbit
  • torch.slice_scatter
  • torch.Tensor.slice_scatter
  • torch.take
  • torch.Tensor.take
  • torch.tensordot
  • torch.tril_indices
  • torch.triu_indices
  • torch.vander
  • torch.logaddexp
  • torch.Tensor.logaddexp
  • torch.logspace
  • torch.moveaxis
  • torch.Tensor.moveaxis
  • torch.nan_to_num
  • torch.Tensor.nan_to_num
  • torch.nanmean
  • torch.Tensor.nanmean
  • torch.nansum
  • torch.Tensor.nansum
  • torch.masked_fill
  • torch.Tensor.addmv_
  • torch.Tensor.addr_
  • torch.Tensor.col_indices
  • torch.Tensor.crow_indices
  • torch.Tensor.erf_
  • torch.Tensor.expm1_
  • torch.Tensor.fix_
  • torch.Tensor.matrix_exp
  • torch.Tensor.mvlgamma_
  • torch.Tensor.negative_
  • torch.Tensor.retain_grad
  • torch.Tensor.sparse_mask
  • torch.Tensor.square_
  • torch.Tensor.to_sparse
  • torch.addmv
  • torch.addr
  • torch.autograd.enable_grad
  • torch.fix
  • torch.histc
  • torch.special.round
  • torch.trunc

相关PR:PaddlePaddle/PaConvert#887PaddlePaddle/docs#7909

是否引起精度变化

@paddle-bot

paddle-bot Bot commented Jun 1, 2026

Copy link
Copy Markdown

你的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.

@PaddlePaddle-bot

PaddlePaddle-bot commented Jun 1, 2026

Copy link
Copy Markdown

🤖 Paddle-CI-Agent | ci_status_monitor | 2026-06-08 03:16:43

CI报告基于以下代码生成(30分钟更新一次):
PR commit: 770b83a | Merge base: 8d925a3 (branch: develop)


1 Required任务 : 40/48 通过

总执行(rerun次数) 总任务 ✅ 通过 ❌ 失败 ⏳ 运行中 ⏸️ 等待中 跳过
80(0) 80 72 6 1 0 0
任务 错误类型 置信度 日志
Static-Check / Test PR问题:API annotation需Typing审批 Job
Linux-XPU / Test PR问题:vander兼容性断言失败 Job
Check approval 需要 Approval Job
Fleet Unit test (single card) 不稳定问题:Fleet单卡测试超时 Job
Linux-DCU / Test PR问题:api兼容测试重跑失败 Job
CE-Framework / Infer 环境问题:urllib连接阶段失败 Job

2 失败详情

🔴 Static-Check / Test — PR问题:API annotation需Typing审批(置信度: 高)
  • 状态: ❌ 失败
  • 根因摘要: API annotation变更缺少Typing组审批
  • 分析器: ci_analyze_paddle

根因详情:
Check api approval 步骤明确要求 API annotation 变更必须获得 Typing group 成员审批。日志列出 paddle.Tensor.addmvpaddle.Tensor.addmv_paddle.Tensor.select_scatterpaddle.Tensor.slice_scatterpaddle.Tensor.tensordot 等 API 差异,随后以 exit code 6 失败。

关键日志:

You must have one member of Typing group approval for API annotation change.
There are 2 approved errors.
API Difference is:
+ paddle.Tensor.addmv (... annotations=...)
+ paddle.Tensor.addmv_ (... annotations=...)
api_params_diff: paddle.Tensor.select_scatter
paddle.Tensor.slice_scatter
paddle.Tensor.tensordot
Process completed with exit code 6.

修复建议:

  1. 请联系 Typing group 成员审批本 PR 的 API annotation 变更。
  2. 若部分 annotation 差异不是预期变更,请回看 python/paddle/tensor/*.pypython/paddle/base/dygraph/tensor_patch_methods.py 中对应 API 的签名/注解。

修复建议摘要: 获取Typing组审批或修正API注解

关联变更: python/paddle/tensor/math.pypython/paddle/tensor/manipulation.pypython/paddle/base/dygraph/tensor_patch_methods.py

链接: 查看日志

🔴 Linux-XPU / Test — PR问题:vander兼容性断言失败(置信度: 高)
  • 状态: ❌ 失败
  • 根因摘要: XPU上vander兼容测试输出不一致
  • 分析器: ci_analyze_paddle

失败用例:

测试 错误 根因
test_api_compatibility_part4.TestVanderAPI.test_dygraph_Compatibility assert_allclose 失败 新增兼容性测试在 XPU 上比较 paddle.vander 多种调用形式输出不一致

根因详情:
Linux-XPU / Testtest_api_compatibility_part4 中失败,且第四次重跑仍失败。失败点是新增测试文件第 485 行,对 out1/out2/out3/out4paddle.vander 动态图输出做 np.testing.assert_allclose;本 PR 新增该兼容性测试并为 vander 暴露 N 别名文档/注解,日志显示 XPU 后端实际输出未通过一致性校验。

关键日志:

1041/1200 Test #1157: test_api_compatibility_part4 ...***Failed
FAIL: test_dygraph_Compatibility (test_api_compatibility_part4.TestVanderAPI)
File "/paddle/build/test/legacy_test/test_api_compatibility_part4.py", line 485
np.testing.assert_allclose(out.numpy(), out1.numpy(), rtol=1e-5)
This is the fourth time to re-run
1157 - test_api_compatibility_part4 (Failed)
Process completed with exit code 8.

修复建议:

  1. 在 XPU 环境复现 test/legacy_test/test_api_compatibility_part4.py::TestVanderAPI::test_dygraph_Compatibility,确认是 N alias、n keyword 还是 increasing=False 路径输出不一致。
  2. 若 XPU vander 后端暂不支持一致行为,请在该测试中按后端加条件处理;若应支持,则修正 python/paddle/tensor/math.pyvander 的参数别名/调用路径。

修复建议摘要: 修正或条件处理XPU vander兼容测试

关联变更: test/legacy_test/test_api_compatibility_part4.py:485python/paddle/tensor/math.py

链接: 查看日志

🔴 Check approval — 需要 Approval(置信度: 高)
  • 状态: ❌ 失败
  • 根因摘要: 该Job需要人工Approval
  • 分析器: builtin

根因详情:
该 Job 需要人工 Approval,完成审批后 CI 才会继续执行。

关键日志:

Process completed with exit code 6.

修复建议:

  1. 请通过人工审批。

修复建议摘要: 请通过人工审批

关联变更: 无

链接: 查看日志

🔴 Fleet Unit test (single card) — 不稳定问题:Fleet单卡测试超时(置信度: 中)
  • 状态: ❌ 失败
  • 根因摘要: Fleet单卡测试耗尽50分钟预算
  • 分析器: ci_analyze_paddle

根因详情:
日志中多个单卡测试已通过,最后在启动 tests/single_card_tests/test_moe_auto_subbatch_deep_gemm.py 后触发 GitHub Action 50 分钟超时。没有看到断言失败或 Python traceback,后续容器删除失败是超时清理阶段的伴随现象。

关键日志:

Test PASSED: tests/single_card_tests/test_swa_gqa.py
Running single card test: tests/single_card_tests/test_moe_auto_subbatch_deep_gemm.py
collected 4 items
The action 'Single card test' has timed out after 50 minutes.
Error response from daemon: cannot remove container ... did not receive an exit event
Process completed with exit code 1.

修复建议:

  1. 先 rerun 该 job;若重复超时,再拆分 Fleet single-card 用例或提高 Single card test 时间预算。
  2. 关注 tests/single_card_tests/test_moe_auto_subbatch_deep_gemm.py 之前的累计耗时,确认是否由新增测试量导致预算耗尽。

修复建议摘要: 先rerun,复现后拆分或延长预算

关联变更: 未发现直接关联;失败发生在 Fleet 单卡测试流程。

链接: 查看日志

🔴 Linux-DCU / Test — PR问题:api兼容测试重跑失败(置信度: 中)
  • 状态: ❌ 失败
  • 根因摘要: DCU上api兼容测试四次重跑失败
  • 分析器: ci_analyze_paddle

失败用例:

测试 错误 根因
test_api_compatibility_part4 CTest 失败,exit code 8 新增 API 兼容性测试在 DCU job 中四次重跑仍失败

根因详情:
深度日志摘要显示 Linux-DCU / TestRun test 步骤失败,失败测试为 test_api_compatibility_part4,并进入第四次重跑后仍失败。compact 日志未展开具体断言值,且返回的本地 log_file_path 与该 job 原始片段不一致,因此当前只能确认失败集中在本 PR 新增的 API 兼容性测试。

关键日志:

The following tests FAILED:
    1112 - test_api_compatibility_part4 (Failed)
This is the fourth time to re-run
The following unittest will be re-run:
test_api_compatibility_part4
1/1 Test #1112: test_api_compatibility_part4 .....***Failed   17.49 sec
Process completed with exit code 8.

修复建议:

  1. 在 DCU 环境单独复现 test/legacy_test/test_api_compatibility_part4.py,拿到完整断言栈后修正对应 API 兼容路径。
  2. 优先检查本 PR 新增的后端敏感测试分支,必要时按 DCU 能力添加 skip 或调整期望值。

修复建议摘要: DCU复现api兼容测试并修正对应分支

关联变更: test/legacy_test/test_api_compatibility_part4.pypython/paddle/tensor/*.py

链接: 查看日志

🔴 CE-Framework / Infer — 环境问题:urllib连接阶段失败(置信度: 中)
  • 状态: ❌ 失败
  • 根因摘要: PaddleTest推理用例urllib连接失败
  • 分析器: ci_analyze_paddle

失败用例:

测试 错误 根因
./test_resnet50_slim.py urllib/http.client connect 栈失败 推理测试依赖的请求连接阶段异常
./test_ppyolo_mkldnn.py urllib/http.client connect 栈失败 推理测试依赖的请求连接阶段异常

根因详情:
CE-Framework / Infer 的 PaddleTest inference 用例在请求连接路径失败,失败汇总列出 test_resnet50_slim.pytest_ppyolo_mkldnn.py。本 PR 主要修改 Python API 兼容性签名和测试,日志中的失败形态更像测试资源/服务连接问题,而不是本 PR 代码逻辑直接导致的推理结果错误。

关键日志:

[test_more_bz_mkldnn]
/usr/lib/python3.10/urllib/request.py:1348
/usr/lib/python3.10/http/client.py:1448: in connect
[test_disable_gpu]
/usr/lib/python3.10/urllib/request.py:1348
============ failed cases =============
./test_resnet50_slim.py
./test_ppyolo_mkldnn.py
Process completed with exit code 8.

修复建议:

  1. 环境问题,请 rerun。
  2. 若 rerun 仍稳定复现,请检查 PaddleTest inference 依赖的模型/服务下载地址或代理环境。

修复建议摘要: 环境问题,请rerun

关联变更: 未发现与本 PR Python API 兼容性改动的直接代码关联。

链接: 查看日志

PaddlePaddle-bot

This comment was marked as outdated.

…nsum/sgn/signbit/slice_scatter/take/tensordot/tril_indices/triu_indices/trunc/vander Edit By AI Agent

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zhwesky20 zhwesky20 changed the title [API Compatibility] select_scatter/sgn/signbit/slice_scatter/tensordot/tril_indices/triu_indices/vander/logaddexp/logspace/moveaxis/nan_to_num/nanmean/nansum/masked_fill Edit By AI Agent [API Compatibility] logaddexp/logspace/moveaxis/nan_to_num/nanmean/nansum/sgn/signbit/slice_scatter/take/tensordot/tril_indices/triu_indices/trunc/vander Edit By AI Agent Jun 1, 2026
PaddlePaddle-bot

This comment was marked as outdated.

@zhwesky2010 zhwesky2010 added API Compatibility and removed contributor External developers labels Jun 2, 2026
@zhwesky20 zhwesky20 changed the title [API Compatibility] logaddexp/logspace/moveaxis/nan_to_num/nanmean/nansum/sgn/signbit/slice_scatter/take/tensordot/tril_indices/triu_indices/trunc/vander Edit By AI Agent [API Compatibility] select_scatter/sgn/signbit/slice_scatter/take/tensordot/tril_indices/triu_indices/vander/logaddexp/logspace/moveaxis/nan_to_num/nanmean/nansum/masked_fill/addmv/addr/fix/histc/trunc Edit By AI Agent Jun 2, 2026
@paddle-bot paddle-bot Bot added the contributor External developers label Jun 2, 2026
PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

…e_scatter Edit By AI Agent

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PaddlePaddle-bot

This comment was marked as outdated.

zhwesky2010 and others added 3 commits June 3, 2026 13:09
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PaddlePaddle-bot

This comment was marked as outdated.

…dices/crow_indices Edit By AI Agent

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zhwesky20 zhwesky20 requested a review from SigureMo as a code owner June 4, 2026 09:12
@zhwesky20 zhwesky20 requested a review from gouzil as a code owner June 4, 2026 09:12
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
zhwesky2010
zhwesky2010 previously approved these changes Jun 4, 2026
@zhwesky2010 zhwesky2010 removed the contributor External developers label Jun 4, 2026
PaddlePaddle-bot

This comment was marked as outdated.

@codecov-commenter

codecov-commenter commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.77301% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@8d925a3). Learn more about missing BASE report.

Files with missing lines Patch % Lines
python/paddle/base/dygraph/tensor_patch_methods.py 90.90% 1 Missing ⚠️
python/paddle/tensor/creation.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #79215   +/-   ##
==========================================
  Coverage           ?   98.77%           
==========================================
  Files              ?        7           
  Lines              ?      163           
  Branches           ?        0           
==========================================
  Hits               ?      161           
  Misses             ?        2           
  Partials           ?        0           

☔ View full report in Codecov by Harness.
📢 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.

@paddle-bot paddle-bot Bot added the contributor External developers label Jun 4, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- logspace: add requires_grad support in PIR mode
- slice_scatter: fix overload signature default values

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PaddlePaddle-bot

This comment was marked as outdated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PaddlePaddle-bot

This comment was marked as outdated.

…ns Edit By AI Agent

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Paddle-CI-Agent | pr_review | 2026-06-08 14:01:18

📋 Review 摘要

PR 概述:为一批 PyTorch 兼容 API 增加别名、out/device/requires_grad 参数和 Tensor 方法。
变更范围python/paddle 公开 API 导出、Tensor patch、API 兼容测试。
影响面 Tag[User Experience]

问题

级别 文件 概述
🔴 兼容性 python/paddle/tensor/manipulation.py:8707 slice_scatter 删除旧有 name 参数,已有按关键字传 name 的 Paddle 调用会 TypeError
🟡 建议 python/paddle/__init__.py:585 新增顶层 API/别名未同步 paddle.__all__from paddle import * 和 API 枚举会漏掉它们

历史 Findings 修复情况

Finding 问题 状态
F1 f_50abb0d1 ⚠️ 仍存在
F2 f_4de13851 ⚠️ 仍存在
F3 f_212459aa ⚠️ 仍存在
F4 f_8a52dab3 ⚠️ 仍存在
F5 f_a2eb0e7e ⚠️ 仍存在
F6 f_df2d2f78 ⚠️ 仍存在
F7 f_4cd8428f ⚠️ 仍存在
F8 f_6c4c98d0 ⚠️ 仍存在
F9 f_cb603504 ⚠️ 仍存在
F10 f_0a70c5ae ⚠️ 仍存在
F11 f_41ec81e5 ⚠️ 仍存在
F12 f_f6f63d8f ⚠️ 仍存在
F13 f_da18dd62 ⚠️ 仍存在
F14 f_0e918a03 ⚠️ 仍存在
F15 f_e3f72cf7 ⚠️ 仍存在
F16 f_21bee88e ⚠️ 仍存在

📝 PR 规范检查

符合规范。PR Category、PR Types、Description、是否引起精度变化均已正确填写。

总体评价

本轮仍发现新增兼容改动中的一个 BC break 和一个公开导出遗漏;同时历史 finding 里多项关键问题仍未修复。建议先恢复旧签名并同步导出列表,再继续处理既有未解决问题。

axes: Sequence[int] = [0],
starts: Sequence[int] = [0],
ends: Sequence[int] | None = None,
strides: Sequence[int] = [1],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 兼容性 slice_scatter 这次把原有的 name 参数从实现签名里删除了。

旧签名支持 paddle.slice_scatter(..., name=...),现在装饰器会把 name 原样传给这个函数并触发 TypeError: got an unexpected keyword argument 'name',这属于公开 API 的 BC break。

建议修复方式:保留 Paddle 旧签名的 name: str | None = None(包括 overload/实现签名),新增 PyTorch 风格参数时只做别名和默认值兼容,不删除既有 name 入口。

Comment thread python/paddle/__init__.py
add_n,
addmm,
addmm_,
addmv,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 建议 这里新增了顶层 addmv/addr 等导入,但没有同步更新下方的 paddle.__all__

tools/print_signatures.py 会读取模块的 __all__ 枚举公开 API,from paddle import * 也依赖它;当前会漏掉本 PR 新增的 addmvaddmv_addraddr_histc 以及 fix/mvlgamma/negative_ 等别名。

建议修复方式:把本 PR 新增的顶层公开 API/别名同步加入 __all__,避免 API 兼容检查和通配导入遗漏。

zhwesky2010 and others added 3 commits June 8, 2026 08:03
…y AI Agent

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Is Edit By AI Agent

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zhwesky2010 zhwesky2010 closed this Jun 8, 2026
@zhwesky2010 zhwesky2010 reopened this Jun 8, 2026

@zhwesky2010 zhwesky2010 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@zhwesky2010 zhwesky2010 requested review from SigureMo and removed request for SigureMo June 8, 2026 13:51
@zhwesky2010 zhwesky2010 removed the contributor External developers label Jun 8, 2026
Comment on lines +96 to +100
list(REMOVE_ITEM TEST_OPS test_api_compatibility_part1)
list(REMOVE_ITEM TEST_OPS test_api_compatibility_part2)
list(REMOVE_ITEM TEST_OPS test_api_compatibility_part3)
list(REMOVE_ITEM TEST_OPS test_api_compatibility_part4)
list(REMOVE_ITEM TEST_OPS test_api_compatibility_part5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这个 PR 只涉及 4、5,但是这里把 1、2、3 也移除了,是预期范围内的吗?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1、2、3后面也可以往里加case,一起顺带移除了,API兼容性不涉及底层Kernel,就不测这个了。

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.

5 participants