Skip to content

Commit

Permalink
【PaddlePaddle Hackathon 3 No.14】为 Paddle 新增 remainder_ API (#5156)
Browse files Browse the repository at this point in the history
* add remainder_ docs

* modified

* modified

* modified

* modified

* modified

* Update docs/api/paddle/remainder__cn.rst

Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>

* Update docs/api/api_label

Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>

* Update docs/api/paddle/remainder__cn.rst

Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>

* modified

* modified

* modified

* modified

* modified

* modified

* modified

* modified

* modified

Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>
  • Loading branch information
zrr1999 and SigureMo committed Aug 31, 2022
1 parent 45cc24a commit 0262a90
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/api/api_label
Expand Up @@ -159,6 +159,8 @@ paddle.floor .. _api_paddle_floor:
paddle.Tensor.floor_ .. _api_paddle_Tensor_floor_:
paddle.floor_divide .. _api_paddle_floor_divide:
paddle.mod .. _api_paddle_mod:
paddle.remainder .. _api_tensor_remainder:
paddle.remainder_ .. _api_tensor_remainder_:
paddle.gather .. _api_paddle_gather:
paddle.gather_nd .. _api_paddle_gather_nd:
paddle.greater_equal .. _api_paddle_greater_equal:
Expand Down
2 changes: 2 additions & 0 deletions docs/api/paddle/Overview_cn.rst
Expand Up @@ -115,6 +115,8 @@ tensor 数学操作
" :ref:`paddle.stanh <cn_api_fluid_layers_stanh>` ", "stanh 激活函数"
" :ref:`paddle.std <cn_api_tensor_cn_std>` ", "沿给定的轴 axis 计算 x 中元素的标准差"
" :ref:`paddle.subtract <cn_api_paddle_tensor_subtract>` ", "逐元素相减算子"
" :ref:`paddle.remainder <cn_api_tensor_remainder>` ", "逐元素取模算子"
" :ref:`paddle.remainder_ <cn_api_tensor_remainder_>` ", "Inplace 版本的 remainder API,对输入 x 采用 Inplace 策略"
" :ref:`paddle.sum <cn_api_tensor_sum>` ", "对指定维度上的 Tensor 元素进行求和运算"
" :ref:`paddle.tan <cn_api_fluid_layers_tan>` ", "三角函数 tangent"
" :ref:`paddle.tanh <cn_api_tensor_tanh>` ", "tanh 激活函数"
Expand Down
11 changes: 10 additions & 1 deletion docs/api/paddle/Tensor_cn.rst
Expand Up @@ -1832,7 +1832,16 @@ remainder(y, name=None)

返回类型:Tensor

mod 函数的别名,请参考 :ref:`cn_api_tensor_mod`
mod 函数的别名,请参考 :ref:`cn_api_tensor_remainder`

remainder_(y, name=None)
:::::::::

返回:计算后的 Tensor

返回类型:Tensor

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

reshape(shape, name=None)
:::::::::
Expand Down
6 changes: 3 additions & 3 deletions docs/api/paddle/mod_cn.rst
Expand Up @@ -15,9 +15,9 @@ mod

参数
:::::::::
- x(Tensor- 多维 Tensor。数据类型为 float32 、float64、int32 或 int64。
- y(Tensor- 多维 Tensor。数据类型为 float32 、float64、int32 或 int64。
- namestr,可选)- 操作的名称(可选,默认值为 None)。更多信息请参见 :ref:`api_guide_Name`。
- **x** (Tensor) - 多维 Tensor。数据类型为 float32 、float64、int32 或 int64。
- **y** (Tensor) - 多维 Tensor。数据类型为 float32 、float64、int32 或 int64。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为 None

返回
:::::::::
Expand Down
8 changes: 8 additions & 0 deletions docs/api/paddle/remainder__cn.rst
@@ -0,0 +1,8 @@
.. _cn_api_tensor_remainder_:

remainder\_
-------------------------------

.. py:function:: paddle.remainder_(x, y, name=None)
Inplace 版本的 :ref:`cn_api_tensor_remainder` API,对输入 `x` 采用 Inplace 策略。
31 changes: 31 additions & 0 deletions docs/api/paddle/remainder_cn.rst
@@ -0,0 +1,31 @@
.. _cn_api_tensor_remainder:

remainder
-------------------------------

.. py:function:: paddle.remainder(x, y, name=None)
逐元素取模算子。公式为:

.. math::
\\out = x \% y\\
.. note::
``paddle.remainder`` 支持广播,如您想了解更多,请参见 :ref:`cn_user_guide_broadcasting` 。

参数
:::::::::

- **x** (Tensor) - 多维 Tensor。数据类型为 float32 、float64、int32 或 int64。
- **y** (Tensor) - 多维 Tensor。数据类型为 float32 、float64、int32 或 int64。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为 None。

返回
:::::::::
``Tensor``,存储运算后的结果。如果 x 和 y 有不同的 shape 且是可以广播的,返回 Tensor 的 shape 是 x 和 y 经过广播后的 shape。如果 x 和 y 有相同的 shape,返回 Tensor 的 shape 与 x,y 相同。

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

COPY-FROM: paddle.remainder

0 comments on commit 0262a90

Please sign in to comment.