[API Compatibility] sgn/signbit/take/tensordot/vander/logaddexp/logspace/moveaxis/nan_to_num/nanmean/nansum/slice_scatter Edit By AI Agent#7904
Open
zhwesky2010 wants to merge 1 commit into
Conversation
…ace/moveaxis/nan_to_num/nanmean/nansum/slice_scatter Edit By AI Agent
|
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7904.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
📚 本次 PR 文档预览链接(点击展开)
|
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 根据 Paddle 主仓 PR(https://github.com/PaddlePaddle/Paddle/pull/78971)对齐 PyTorch 兼容性改动,集中更新多项 Paddle API 的中文 .rst 文档(签名、参数别名、关键字参数如 out 等),以反映最新的 API 形态与别名支持。
Changes:
- 为部分 API 文档补齐/更新函数签名(如新增仅关键字参数
out,以及logspace的device/requires_grad等)。 - 在参数说明中补充与 PyTorch 对齐的参数别名(如
x↔input、y↔other、axes↔dims等)。 - 为新增的仅关键字参数补充“关键字参数”小节。
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/api/paddle/vander_cn.rst | 为 n 参数补充别名说明(N)。 |
| docs/api/paddle/tensordot_cn.rst | 更新签名以支持 out,并为 x/y/axes 增加别名与关键字参数说明。 |
| docs/api/paddle/take_cn.rst | 为 x 参数补充别名 input。 |
| docs/api/paddle/slice_scatter_cn.rst | 为多参数补充别名,并将若干参数类型扩展为支持 int。 |
| docs/api/paddle/signbit_cn.rst | 更新签名以支持 out,并为 x 增加别名 input。 |
| docs/api/paddle/sgn_cn.rst | 更新签名以支持 out,并为 x 增加别名 input。 |
| docs/api/paddle/nansum_cn.rst | 更新签名以支持 out,并为 x/axis 增加别名。 |
| docs/api/paddle/nanmean_cn.rst | 更新签名以补充 dtype 与 out,并为 x/axis 增加别名。 |
| docs/api/paddle/nan_to_num_cn.rst | 更新签名以支持 out,并为 x 增加别名 input。 |
| docs/api/paddle/moveaxis_cn.rst | 为 x 参数补充别名 input。 |
| docs/api/paddle/logspace_cn.rst | 更新签名以支持 out/device/requires_grad,并为参数补充别名与关键字参数说明。 |
| docs/api/paddle/logaddexp_cn.rst | 更新签名以支持 out,并为 x/y 增加别名与关键字参数说明。 |
Comments suppressed due to low confidence (2)
docs/api/paddle/logaddexp_cn.rst:10
- 文档中的数学公式与返回值描述都写成了
logaddexp(x),但该函数有两个输入x/y,应表述为logaddexp(x, y)(与签名一致)。建议同步修正公式与“返回”部分的函数记法,避免把y漏掉。
.. py:function:: paddle.logaddexp(x, y, name=None, *, out=None)
计算 ``x`` 和 ``y`` 的以 e 为底的指数的和的自然对数。计算公式如下:
.. math::
docs/api/paddle/logspace_cn.rst:10
- 这里同时声明“
paddle.logspace不进行梯度计算”但又新增了requires_grad参数并描述会设置stop_gradient。这两者语义上冲突:要么移除/隐藏requires_grad,要么在 note/参数说明中明确该 op 不支持反向、requires_grad仅影响属性标记等。
.. py:function:: paddle.logspace(start, stop, num, base=10.0, dtype=None, name=None, *, out=None, device=None, requires_grad=False)
返回一个 Tensor,Tensor 的值为在区间 :math:`[base^{start}, base^{stop}]` 上按对数均匀间隔的 :math:`num` 个值,输出 Tensor 的长度为 num。
.. note::
| :::::::::: | ||
| - **x** (Tensor) - 输入的 Tensor,必须是 1-D Tensor, 支持的数据类型:int32、int64、float32、float64、complex64、complex128。 | ||
| - **n** (int,可选) - 输出中的列数。如果未指定 n,则返回一个方阵(n = len(x))。 | ||
| - **n** (int,可选) - 输出中的列数。如果未指定 n,则返回一个方阵(n = len(x))。别名 ``N``。 |
Comment on lines
+21
to
+24
| - **axes** (int|list|tuple) - 指定沿着哪几个维度嵌入对应的值。别名 ``dim``。 | ||
| - **starts** (int|list|tuple) - 嵌入的起始索引。别名 ``start``。 | ||
| - **ends** (int|list|tuple) - 嵌入的截止索引。别名 ``end``。 | ||
| - **strides** (int|list|tuple) - 嵌入的步长。别名 ``step``。 |
|
|
||
| 返回 | ||
| :::::::::::: | ||
| Tensor,输出掩码,数据的 shape 大小及数据类型和输入 ``x`` 一致。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
API Compatibility Edit By AI Agent:
```
torch.sgn
torch.Tensor.sgn
torch.signbit
torch.Tensor.signbit
torch.take
torch.Tensor.take
torch.tensordot
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.slice_scatter
torch.Tensor.slice_scatter
```