Skip to content

[API Compatibility] nll_loss/bernoulli_/weight_norm/resize_/imag/Flatten/kl_div/GRU/Softmax/L1Loss/avg_pool2d/LogSoftmax/hann_window/det/pinverse/addcdiv_/real/inv/ParameterList/scatter_reduce_/xavier_uniform/ge_/sign_/pinv/take/resize_as_/huber_loss/float/set_default_tensor_type/fmod/pack_padded_sequence/pad_packed_sequence/ctc_loss/nan_to_num/fmod_/fill_diagonal_/assert_allclose/absolute/randint_like Edit By AI Agent#79312

Merged
zhwesky2010 merged 6 commits into
PaddlePaddle:developfrom
zhwesky20:claude
Jun 26, 2026

Conversation

@zhwesky20

@zhwesky20 zhwesky20 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

PR Category

User Experience

PR Types

Improvements

Description

API Compatibility Edit By AI Agent:

  • torch.nn.functional.nll_loss
  • torch.Tensor.bernoulli_
  • torch.nn.utils.weight_norm
  • torch.Tensor.resize_
  • torch.nn.Flatten
  • torch.nn.functional.kl_div
  • torch.nn.GRU
  • torch.nn.L1Loss
  • torch.hann_window
  • torch.det
  • torch.pinverse
  • torch.Tensor.addcdiv_
  • torch.linalg.inv
  • torch.nn.ParameterList
  • torch.Tensor.scatter_reduce_
  • torch.nn.init.xavier_uniform
  • torch.Tensor.sign_
  • torch.linalg.pinv
  • torch.Tensor.take
  • torch.Tensor.resize_as_
  • torch.nn.functional.huber_loss
  • torch.float
  • torch.set_default_tensor_type
  • torch.Tensor.fmod
  • torch.nn.utils.rnn.pack_padded_sequence
  • torch.nn.utils.rnn.pad_packed_sequence
  • torch.nan_to_num
  • torch.Tensor.fmod_
  • torch.Tensor.fill_diagonal_
  • torch.testing.assert_allclose
  • torch.Tensor.absolute
  • torch.randint_like

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

是否引起精度变化

@zhwesky20 zhwesky20 changed the title [API Compatibility] det/pinverse/addcdiv/addcdiv_/imag/real/scatter_reduce_/sign_/LogSoftmax/Flatten/kl_div/nll_loss/pack_padded_sequence/pad_packed_sequence/weight_norm/inv/pinv/bernoulli_/fmod/fmod_ Edit By AI Agent [API Compatibility] nll_loss/bernoulli_/weight_norm/resize_/imag/Flatten/kl_div/GRU/Softmax/L1Loss/avg_pool2d/LogSoftmax/hann_window/det/pinverse/addcdiv_/real/inv/ParameterList/scatter_reduce_/xavier_uniform/ge_/sign_/pinv/take/resize_as_/huber_loss/float/set_default_tensor_type/fmod/pack_padded_sequence/pad_packed_sequence/ctc_loss/nan_to_num/fmod_/fill_diagonal_/assert_allclose/absolute/randint_like Edit By AI Agent Jun 12, 2026
@zhwesky20 zhwesky20 force-pushed the claude branch 2 times, most recently from 6a2b673 to ef836e5 Compare June 12, 2026 15:31
PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

@paddle-bot paddle-bot Bot added the contributor External developers label Jun 12, 2026
@PaddlePaddle-bot

PaddlePaddle-bot commented Jun 14, 2026

Copy link
Copy Markdown

🤖 Paddle-CI-Agent | ci_status_monitor | 2026-06-26 00:51:46 UTC+08:00

CI报告基于以下代码生成(30分钟更新一次):
PR commit: 28368ca | Merge base: 406c7af (branch: develop)


1 Required任务 : 30/32 通过

总执行(rerun次数) 总任务 ✅ 通过 ❌ 失败 ⏳ 运行中 ⏸️ 等待中 跳过
142(91) 51 49 2 0 0 0
任务 错误类型 置信度 日志
PR-CI-SOT / Build and Test 环境问题 Job
Check approval 需要 Approval Job

2 失败详情

🔴 PR-CI-SOT / Build and Test — 环境问题(置信度: 高)

分析器: 通用分析(fallback)
失败用例: 无,测试未执行;失败发生在 Test with python3.14 的依赖安装阶段。

用例 错误摘要
Test with python3.14 pip 安装 numpy>=2.3.5 时无法卸载无 RECORD 的 numpy None

关键日志:

Uninstalling numpy for Python 3.14...
Successfully uninstalled numpy-2.4.6
Installing numpy>=2.3.5 for Python 3.14...
Found existing installation: numpy None
error: uninstall-no-record-file
Cannot uninstall numpy None
The package's contents are unknown: no RECORD file was found for numpy.
Installing numpy>=2.3.5 for Python 3.14... with exit code 1
  • 根因摘要: Python3.14 环境 numpy 包元数据异常

日志显示失败发生在 ci/run_sot_test.sh 的 Python 3.14 特殊依赖安装分支:该脚本先卸载 numpy,再执行 pip install --force-reinstall --no-cache-dir "numpy>=2.3.5"。第二次安装时 pip 仍发现一个缺少 RECORD 的 numpy None,导致依赖安装直接退出,未进入 SOT unittest。PR 未修改该 CI 脚本或 SOT 流程,且 Python 3.10/3.11/3.12/3.13 的 build/test 均已通过,因此判断为 CI 环境问题。

修复建议:

  1. 环境问题,请 rerun;若复现,需修复 CI Python 3.14 镜像或安装脚本,改用 --ignore-installed/清理残留 dist-info 后再安装 numpy。

关联变更: PR 主要修改 API 兼容入口和 test_api_compatibility_* 用例;未修改 ci/run_sot_test.sh

🔴 Check approval — 需要 Approval(置信度: 高)

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

修复建议:

  1. 请通过人工审批。

@zhwesky2010 zhwesky2010 added API Compatibility and removed contributor External developers labels Jun 14, 2026
@paddle-bot paddle-bot Bot added the contributor External developers label Jun 14, 2026
@zhwesky20 zhwesky20 force-pushed the claude branch 3 times, most recently from 7ad2b9c to 4e1e6e9 Compare June 16, 2026 14:38
PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

@zhwesky20 zhwesky20 force-pushed the claude branch 4 times, most recently from fde6d61 to 20f8c4d Compare June 17, 2026 16:04
PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

@zhwesky20 zhwesky20 force-pushed the claude branch 2 times, most recently from 36c3c4d to e53a098 Compare June 24, 2026 10:52
PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

zhwesky2010
zhwesky2010 previously approved these changes Jun 24, 2026
@zhwesky2010 zhwesky2010 requested a review from SigureMo June 24, 2026 15:14
SigureMo
SigureMo previously approved these changes Jun 24, 2026
@zhwesky20 zhwesky20 dismissed stale reviews from SigureMo and zhwesky2010 via 28368ca June 25, 2026 07:55

@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-25 16:22:38

📋 Review 摘要

PR 概述:为多组 PyTorch 兼容 API 增加别名、签名适配、导出和回归测试。
变更范围:Python 公开 API、Tensor/NN/RNN 工具、Phi YAML/PIR symbolic shape、legacy API compatibility tests。
影响面 Tag[User Experience] [Operator Mechanism] [Execute Infrastructure]

问题

⚠️ 本 PR 变更量较大(34 文件 / 4190 行),建议拆分以降低审查难度和合入风险。

级别 文件 概述
🟡 建议 PR 结构 PR 同时修改几十个 API、YAML/codegen 和大量测试,建议按功能组拆分,降低审查和回归定位成本。

本轮未发现新的、未被历史 finding 覆盖的阻塞性代码问题。

建议拆分方案

  • PR 1: Tensor/math/linalg/random 兼容别名 — python/paddle/tensor/*, python/paddle/__init__.py, python/paddle/_paddle_docs.py
  • PR 2: NN/RNN/containers/loss 兼容适配 — python/paddle/nn/*, python/paddle/utils/decorator_utils.py
  • PR 3: YAML/PIR codegen 联动 — paddle/phi/ops/yaml/*, paddle/fluid/pir/dialect/operator/interface/infer_symbolic_shape/*
  • PR 4: API compatibility 测试与 CMake 调整 — test/legacy_test/*

历史 Findings 修复情况

本轮按风险优先复核了部分历史问题;以下仍存在,未重复发 inline comment。

Finding 问题 状态
F1 pinv(A=...) alias 仍未生效 ⚠️ 仍存在
F2 paddle.fmod 仍 alias 到 remainder ⚠️ 仍存在
F3 fmod_ 仍复用 remainder_ ⚠️ 仍存在
F4/F15 pack_padded_sequence 排序与长度边界校验仍缺失 ⚠️ 仍存在
F6 randint_like(device=None) 仍未使用输入 Tensor device ⚠️ 仍存在
F7 PackedSequence 仍不能进入 RNN/GRU forward ⚠️ 仍存在
F8 GRU(dtype/device) 仍未传到 GRUCell ⚠️ 仍存在
F9 set_default_tensor_type(paddle.float32) 仍被拒绝 ⚠️ 仍存在
F14/F18 paddle.testing.__all__ 仍缺少新增/已有导出 ⚠️ 仍存在
F19 ctc_loss 仍未处理 PyTorch 位置参数顺序 ⚠️ 仍存在
F20/F23 imag/real 属性与 tensor 子包导出问题仍存在 ⚠️ 仍存在
F25 resize_as_ 仍不接受 tensor= / memory_format= ⚠️ 仍存在
F26 Softmax(dim=...) 仍未实现 ⚠️ 仍存在
F28 ROCm 仍会跳过 API compatibility part1-part5 ⚠️ 仍存在
F29/F32 pack_padded_sequence/invert_permutation 的边界与静态图问题仍存在 ⚠️ 仍存在

📝 PR 规范检查

标题 Tag 不在当前仓库模板枚举中。描述结构包含必填 section,精度变化字段已填写为“否”。

标题建议(可直接复制):

  • [User Experience] Add PyTorch-compatible aliases for Paddle APIs

总体评价

本轮按风险优先覆盖了 Python API 导出/签名、RNN pack utilities、YAML/PIR symbolic shape、测试门控等语义点;未全量覆盖 test_api_compatibility_part5.py 的所有机械测试用例。当前主要风险仍是历史 findings 未收敛,建议先修复这些已确认问题后再继续扩大兼容 API 范围。

@zhwesky2010 zhwesky2010 requested review from SigureMo and removed request for SigureMo June 25, 2026 11:52
@zhwesky2010 zhwesky2010 removed the contributor External developers label Jun 26, 2026
@zhwesky2010 zhwesky2010 merged commit 98d83a4 into PaddlePaddle:develop Jun 26, 2026
289 of 302 checks passed
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.

8 participants