Skip to content

[API Compatibility No.13、75] Add param alias for hypot and hypot_#7851

Merged
luotao1 merged 2 commits intoPaddlePaddle:developfrom
Khoray:apicom-13-75-hypot
Mar 11, 2026
Merged

[API Compatibility No.13、75] Add param alias for hypot and hypot_#7851
luotao1 merged 2 commits intoPaddlePaddle:developfrom
Khoray:apicom-13-75-hypot

Conversation

@Khoray
Copy link
Contributor

@Khoray Khoray commented Mar 9, 2026

PR Category

User Experience

PR Types

New features

Description

  • paddle.hypotpaddle.hypot_ 添加参数别名
  • paddle.hypot 新增 out 参数
  • 为新增参数增加单测

Related Issue: PaddlePaddle/Paddle#76301

Related PRs:

是否引起精度变化

Copilot AI review requested due to automatic review settings March 9, 2026 06:55
@paddle-bot
Copy link

paddle-bot bot commented Mar 9, 2026

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

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

📚 本次 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 更新了飞桨 paddle.hypot / paddle.hypot_ 的中文 API 文档,以配合新增的参数别名能力,并为 paddle.hypot 补充 out 关键字参数的文档入口。

Changes:

  • 更新 paddle.hypot 的函数签名,新增 out 关键字参数,并在参数区补充别名说明
  • 更新 paddle.hypot_ 的函数签名,新增 out 关键字参数

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
docs/api/paddle/hypot_cn.rst 更新 hypot 签名并补充参数别名与 out 关键字参数说明
docs/api/paddle/hypot__cn.rst 更新 hypot_ 签名以包含 out 关键字参数

Comment on lines +16 to +17
- **x** (Tensor) – 输入 Tensor,它的数据类型可以是 float32,float64, int32, int64。别名 ``input``。
- **y** (Tensor) – 输入 Tensor,它的数据类型可以是 float32,float64,int32, int64。别名 ``other``。
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

参数列表中数据类型枚举存在多余空格(如 float64, int32int32, int64),且同一列表项里使用的分隔符风格不一致。建议去掉中文逗号后的空格,并与仓库中多数 API 文档保持一致的枚举写法(例如使用 分隔或至少保持无空格的 分隔)。

Suggested change
- **x** (Tensor) – 输入 Tensor,它的数据类型可以是 float32,float64, int32, int64。别名 ``input``。
- **y** (Tensor) – 输入 Tensor,它的数据类型可以是 float32,float64,int32, int64。别名 ``other``。
- **x** (Tensor) – 输入 Tensor,它的数据类型可以是 float32,float64,int32,int64。别名 ``input``。
- **y** (Tensor) – 输入 Tensor,它的数据类型可以是 float32,float64,int32,int64。别名 ``other``。

Copilot uses AI. Check for mistakes.

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

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

关键字参数 下的 bullet list 结束后紧接着就是下一节 返回 标题,中间缺少空行,容易导致 Sphinx/reST 解析产生告警或渲染异常。建议在 out 参数条目后补一个空行,再开始 返回 小节。

Suggested change
- **out** (Tensor,可选) - 输出 Tensor,若不为 ``None``,计算结果将保存在该 Tensor 中,默认值为 ``None``。
- **out** (Tensor,可选) - 输出 Tensor,若不为 ``None``,计算结果将保存在该 Tensor 中,默认值为 ``None``。

Copilot uses AI. Check for mistakes.
.. py:function:: paddle.hypot_(x, y, name=None, *, out=None)

Inplace 版本的 :ref:`cn_api_paddle_hypot` API,对输入 x 采用 Inplace 策略。

Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

该文档仅更新了签名以支持参数别名/out,但正文未说明别名能力。为与已有 inplace API 文档保持一致,建议补充 .. note::(参考 docs/api/paddle/abs__cn.rst)说明 input/other 可分别替代 x/y(如确实已支持)。

Suggested change
.. note::
该 API 支持使用 ``input`` 和 ``other`` 作为 ``x`` 和 ``y`` 的参数别名,即 ``input`` 等价于 ``x``,``other`` 等价于 ``y``。请勿在同一次调用中同时使用 ``x`` 与 ``input`` 或 ``y`` 与 ``other``。

Copilot uses AI. Check for mistakes.
-------------------------------

.. py:function:: paddle.hypot_(x, y, name=None)
.. py:function:: paddle.hypot_(x, y, name=None, *, out=None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个没有out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经修改

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Mar 10, 2026
Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit 3bd8056 into PaddlePaddle:develop Mar 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor HappyOpenSource 快乐开源活动issue与PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants