Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Prim] 为 Paddle 新增 reduce_as API 中文文档 #6621

Merged
merged 3 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api/paddle/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ tensor 数学操作
" :ref:`paddle.hypot <cn_api_paddle_hypot>` ", "对输入 直角三角形的直角边 Tensor x, y, 计算其斜边"
" :ref:`paddle.combinations <cn_api_paddle_combinations>` ", "对输入 Tensor 计算长度为 r 的情况下的所有组合"
" :ref:`paddle.select_scatter <cn_api_paddle_select_scatter>` ", "根据 axis 和 index(整数) 填充 value 值至输入 Tensor"
" :ref:`paddle.reduce_as <cn_api_paddle_reduce_as>` ", "对 x 在某些维度上求和,使其结果与 target 的 shape 一致"
.. _tensor_math_inplace:

tensor 数学操作原位(inplace)版本
Expand Down
25 changes: 25 additions & 0 deletions docs/api/paddle/reduce_as_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. _cn_api_paddle_reduce_as:

reduce_as
-------------------------------

.. py:function:: paddle.reduce_as(x, target, name=None):

对 x 在某些维度上求和,使其结果与 target 的 shape 一致。


参数
::::::::::::

- **x** (Tensor) - 输入变量为多维 Tensor,支持数据类型为 bool、float16、 float32、float64、int8、uint8、int16、uint16、int32、int64、complex64 以及 complex128。
- **target** (Tensor) - 输入变量为多维 Tensor,x 的 shape 长度必须大于或等于 target 的 shape 长度。支持数据类型为 bool、float16、 float32、float64、int8、uint8、int16、uint16、int32、int64、complex64 以及 complex128。
- **name** (str, 可选) - 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为 None。
返回
::::::::::::

Tensor,输入 x 沿某些轴进行求和,使其结果与 target 的 shape 相同,如果 x 的 type 为 bool 或者为 int32,返回值的 type 将变为 int64,否则返回值的 type 与 x 相同。

代码示例
::::::::::::

COPY-FROM: paddle.reduce_as