Skip to content

Conversation

@zhwesky2010
Copy link
Collaborator

@zhwesky2010 zhwesky2010 commented Dec 31, 2025

主要修改内容

1. AI编程规则文件

适用于《Paddle API兼容性项目》工作,定义了以下规则文件:

  • API兼容性主控规则 (0-api-compatibility.mdr)
  • 方案决策规则 (1-scheme-decision.mdr)
  • C++下沉规则 (2-2-sink-to-cpp.mdr)
  • Pytorch对齐测试规则 (3-paconvert-test.mdr)
  • 文档修改规则 (4-modify-docs.mdr)

规则文件本身无法独立运行,必须与Agent配合使用,作为Agent执行的指令依据。系统采用主控智能体 + 子智能体的协作架构,上述5份规则文件分别对应不同智能体的执行指令。通过各智能体的协同工作,完成了以下Paddle / PaConvert / Docs的开发。

2. 代码开发

3. 文档更新

  • 中文API文档开发:更新了相关API文档,优化了API签名和参数说明,增加了关键字参数 out 的支持说明,代码提交至本PR

涉及API

本PR涉及以下15个API的文档更新:

torch.fmax
torch.fmin
torch.bincount
torch.diag
torch.atan
torch.tan
torch.bitwise_and
torch.bitwise_not
torch.bitwise_xor
torch.nextafter
torch.angle
torch.heaviside
torch.asinh
torch.reciprocal
torch.square

技术特点

  • 自动化开发流程:代码均基于AI Agent自动编码生成,确保了代码风格和实现的一致性
  • 完整的测试覆盖:每个API均包含全面的兼容性测试,覆盖Pytorch与Paddle两套签名的各种可能用法,测试用例完备规范

本PR描述由 AI 辅助生成

Copilot AI review requested due to automatic review settings December 31, 2025 02:16
@paddle-bot
Copy link

paddle-bot bot commented Dec 31, 2025

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7676.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@github-actions
Copy link

github-actions bot commented Dec 31, 2025

📚 本次 PR 文档预览链接(点击展开)
ℹ️ 预览提醒
请等待 Docs-NEW 流水线运行完成后再点击预览链接,否则可能会看到旧版本内容或遇到链接无法访问的情况。

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

本 PR 是由 AI Agent 自动生成的 API 兼容性编辑,主要目的是为多个 Paddle API 添加与 PyTorch 兼容的 out 参数支持和参数别名,并相应删除了不再需要的 PyTorch API 差异对比文档。

主要变更包括:

  • 为 15 个 Paddle API 添加了 out 参数支持(作为关键字参数)
  • 为这些 API 的参数添加了 PyTorch 兼容的别名(如 inputothervaluesdiagonal
  • 删除了 19 个 PyTorch 与 Paddle API 差异对比文档(因为差异已消除)

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 24 comments.

Show a summary per file
File Description
docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.square.md 删除 torch.square 与 paddle.square 的 API 差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.reciprocal.md 删除 torch.reciprocal 与 paddle.reciprocal 的 API 差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nextafter.md 删除 torch.nextafter 与 paddle.nextafter 的 API 差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.heaviside.md 删除 torch.heaviside 与 paddle.heaviside 的 API 差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.fmin.md 删除 torch.fmin 与 paddle.fmin 的 API 差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.fmax.md 删除 torch.fmax 与 paddle.fmax 的 API 差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.diag.md 删除 torch.diag 与 paddle.diag 的 API 差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.atan.md 删除 torch.atan 与 paddle.atan 的 API 差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.asinh.md 删除 torch.asinh 与 paddle.asinh 的 API 差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.angle.md 删除 torch.angle 与 paddle.angle 的 API 差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.tan.md 删除 torch.tan 与 paddle.tan 的参数名差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.bitwise_xor.md 删除 torch.bitwise_xor 与 paddle.bitwise_xor 的参数名差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.bitwise_not.md 删除 torch.bitwise_not 与 paddle.bitwise_not 的参数名差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.bitwise_and.md 删除 torch.bitwise_and 与 paddle.bitwise_and 的参数名差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.bincount.md 删除 torch.bincount 与 paddle.bincount 的参数名差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.bitwise_xor_.md 删除 torch.Tensor.bitwise_xor_ 与 paddle.Tensor.bitwise_xor_ 的参数名差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.bitwise_xor.md 删除 torch.Tensor.bitwise_xor 与 paddle.Tensor.bitwise_xor 的参数名差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.bitwise_and_.md 删除 torch.Tensor.bitwise_and_ 与 paddle.Tensor.bitwise_and_ 的参数名差异文档
docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.bitwise_and.md 删除 torch.Tensor.bitwise_and 与 paddle.Tensor.bitwise_and 的参数名差异文档
docs/api/paddle/tan_cn.rst 添加 out 参数和 input 别名
docs/api/paddle/square_cn.rst 添加 out 参数和 input 别名
docs/api/paddle/reciprocal_cn.rst 添加 out 参数和 input 别名
docs/api/paddle/nextafter_cn.rst 添加 out 参数以及 input、other 别名
docs/api/paddle/heaviside_cn.rst 添加 out 参数以及 input、values 别名
docs/api/paddle/fmin_cn.rst 添加 out 参数以及 input、other 别名
docs/api/paddle/fmax_cn.rst 添加 out 参数以及 input、other 别名
docs/api/paddle/diag_cn.rst 添加 input、diagonal 别名(未添加 out 参数,可能因为已有特殊处理)
docs/api/paddle/bitwise_xor_cn.rst 调整参数顺序,将 out 改为关键字参数,添加 input、other 别名
docs/api/paddle/bitwise_not_cn.rst 调整参数顺序,将 out 改为关键字参数,添加 input 别名
docs/api/paddle/bitwise_and_cn.rst 调整参数顺序,将 out 改为关键字参数,添加 input、other 别名
docs/api/paddle/bincount_cn.rst 添加 input 别名
docs/api/paddle/atan_cn.rst 添加 input 别名(未添加 out 参数,可能因为已有特殊处理)
docs/api/paddle/asinh_cn.rst 添加 out 参数和 input 别名
docs/api/paddle/angle_cn.rst 添加 out 参数和 input 别名

Comment on lines +23 to +24
- **x** (Tensor)- 输入的 Tensor。数据类型为 ``bfloat16`` 、 ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 或 ``int64`` 。别名 ``input`` 。
- **y** (Tensor)- 输入的 Tensor。数据类型为 ``bfloat16`` 、 ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 或 ``int64`` 。别名 ``other`` 。
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

中文和英文之间缺少空格。应该将 别名 ``input``` 和 别名 other``` 改为 `别名:input 和 `别名:``other,以符合文档书写规范。

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +21 to +22
- **x** (Tensor) - 输入的 `Tensor`。它的形状可以是一维或二维。其数据类型应为 float16、float32、float64、int32、int64、complex64、complex128。别名 ``input`` 。
- **offset** (int,可选) - 对角线偏移量。正值表示上对角线,0 表示主对角线,负值表示下对角线。默认值为 0。别名 ``diagonal`` 。
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

中文和英文之间缺少空格。应该将 别名 ``input``` 和 别名 diagonal``` 改为 `别名:input 和 `别名:``diagonal,以符合文档书写规范。

Copilot generated this review using guidance from repository custom instructions.

- **x** (Tensor)- 输入的 N-D `Tensor`,数据类型为:bool,uint8,int8,int16,int32,int64。
- **out** (Tensor,可选)- 输出的结果 `Tensor`,是与输入数据类型相同的 N-D `Tensor`。默认值为 None,此时将创建新的 Tensor 来保存输出结果。
- **x** (Tensor)- 输入的 N-D `Tensor`,数据类型为:bool,uint8,int8,int16,int32,int64。别名 ``input``。
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

中文和英文之间缺少空格。应该将 别名 ``input``` 改为 别名:``input```,以符合文档书写规范。

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +20 to +21
- **x** (Tensor)- 输入的 N-D `Tensor`,数据类型为:bool,uint8,int8,int16,int32,int64。别名 ``input``。
- **y** (Tensor)- 输入的 N-D `Tensor`,数据类型为:bool,uint8,int8,int16,int32,int64。别名 ``other``。
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

中文和英文之间缺少空格。应该将 别名 ``input``` 和 别名 other``` 改为 `别名:input 和 `别名:``other,以符合文档书写规范。

Copilot generated this review using guidance from repository custom instructions.

关键字参数
:::::::::
- **out** (Tensor,可选) - 输出 Tensor,若不为 ``None``,计算结果将保存在该 Tensor 中,默认值为 ``None``。
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

中文和英文之间缺少空格。应该将 若不为 ``None``` 改为 若不为 None```(在 None`` 前添加空格),以符合文档书写规范中关于中英文间需要空格分隔的要求。

Copilot generated this review using guidance from repository custom instructions.

关键字参数
:::::::::
- **out** (Tensor,可选) - 输出 Tensor,若不为 ``None``,计算结果将保存在该 Tensor 中,默认值为 ``None``。
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

中文和英文之间缺少空格。应该将 若不为 ``None``` 改为 若不为 None```(在 None`` 前添加空格),以符合文档书写规范中关于中英文间需要空格分隔的要求。

Copilot generated this review using guidance from repository custom instructions.

关键字参数
:::::::::
- **out** (Tensor,可选) - 输出 Tensor,若不为 ``None``,计算结果将保存在该 Tensor 中,默认值为 ``None``。
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

中文和英文之间缺少空格。应该将 若不为 ``None``` 改为 若不为 None```(在 None`` 前添加空格),以符合文档书写规范中关于中英文间需要空格分隔的要求。

Copilot generated this review using guidance from repository custom instructions.
参数
:::::::::
- **x** (Tensor) - 该 OP 的输入为 Tensor。数据类型为 float32,float64,complex64,complex128。别名 ``input``。
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

中文和英文之间缺少空格。应该将 别名 ``input``` 改为 别名:``input```,以符合文档书写规范中关于中英文间需要空格分隔的要求。此外,建议在"别名"后添加冒号以保持一致性。

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +21 to +22
- **x** (Tensor)- 输入的 N-D `Tensor`,数据类型为:bool,uint8,int8,int16,int32,int64。别名 ``input``。
- **y** (Tensor)- 输入的 N-D `Tensor`,数据类型为:bool,uint8,int8,int16,int32,int64。别名 ``other``。
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

中文和英文之间缺少空格。应该将 别名 ``input``` 和 别名 other``` 改为 `别名:input 和 `别名:``other,以符合文档书写规范。

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +28 to +29
- **x** (Tensor) - 赫维赛德阶跃函数的输入 Tensor。数据类型为 bfloat16、float16、float32、float64、int32 或 int64。别名 ``input``。
- **y** (Tensor) - 决定了一个赫维赛德阶跃函数的 Tensor。数据类型为 bfloat16、float16、float32、float64、int32 或 int64。别名 ``values``。
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

中文和英文之间缺少空格。应该将 别名 ``input``` 和 别名 values``` 改为 `别名:input 和 `别名:``values,以符合文档书写规范。

Copilot generated this review using guidance from repository custom instructions.
@zhwesky2010 zhwesky2010 changed the title API Compatibility Edit by AI Agent API Compatibility Edit by AI Agent (Agent Coding Rules) Jan 5, 2026
@zhwesky2010 zhwesky2010 changed the title API Compatibility Edit by AI Agent (Agent Coding Rules) API Compatibility Edit by AI Agent (AI Coding Rules) Jan 5, 2026
@zhwesky2010 zhwesky2010 force-pushed the coding_agent branch 4 times, most recently from b262c08 to 05bf635 Compare January 5, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant