Skip to content

Commit

Permalink
【doc】Add divide, floor_divide, remainder doc (#2437)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxicoding authored Aug 22, 2020
1 parent d068604 commit 9cfbc97
Show file tree
Hide file tree
Showing 13 changed files with 207 additions and 162 deletions.
6 changes: 5 additions & 1 deletion doc/fluid/api/tensor/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ math
math/addmm.rst
math/atan.rst
math/clamp.rst
math/div.rst
math/divide.rst
math/floor_divide.rst
math/remainder.rst
math/floor_mod.rst
math/mod.rst
math/elementwise_sum.rst
math/log1p.rst
math/logsumexp.rst
Expand Down
11 changes: 11 additions & 0 deletions doc/fluid/api/tensor/math/divide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_tensor_math_divide:

divide
------

.. autofunction:: paddle.tensor.math.divide
:noindex:

11 changes: 11 additions & 0 deletions doc/fluid/api/tensor/math/floor_divide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_tensor_math_floor_divide:

floor_divide
------------

.. autofunction:: paddle.tensor.math.floor_divide
:noindex:

11 changes: 11 additions & 0 deletions doc/fluid/api/tensor/math/floor_mod.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_tensor_math_floor_mod:

floor_mod
---------

.. autofunction:: paddle.tensor.math.floor_mod
:noindex:

11 changes: 11 additions & 0 deletions doc/fluid/api/tensor/math/mod.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_tensor_math_mod:

mod
---

.. autofunction:: paddle.tensor.math.mod
:noindex:

11 changes: 11 additions & 0 deletions doc/fluid/api/tensor/math/remainder.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_tensor_math_remainder:

remainder
---------

.. autofunction:: paddle.tensor.math.remainder
:noindex:

6 changes: 5 additions & 1 deletion doc/fluid/api_cn/tensor_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ paddle.tensor
tensor_cn/cumsum_cn.rst
tensor_cn/diag_cn.rst
tensor_cn/dist_cn.rst
tensor_cn/div_cn.rst
tensor_cn/divide_cn.rst
tensor_cn/floor_divide_cn.rst
tensor_cn/remainder_cn.rst
tensor_cn/mod_cn.rst
tensor_cn/floor_mod_cn.rst
tensor_cn/dot_cn.rst
tensor_cn/einsum_cn.rst
tensor_cn/elementwise_add_cn.rst
Expand Down
160 changes: 0 additions & 160 deletions doc/fluid/api_cn/tensor_cn/div_cn.rst

This file was deleted.

43 changes: 43 additions & 0 deletions doc/fluid/api_cn/tensor_cn/divide_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.. _cn_api_tensor_divide:

divide
-------------------------------

.. py:function:: paddle.divide(x, y, name=None)
该OP是逐元素相除算子,输入 ``x`` 与输入 ``y`` 逐元素相除,并将各个位置的输出元素保存到返回结果中。
输入 ``x`` 与输入 ``y`` 必须可以广播为相同形状, 关于广播规则,请参考 :ref:`use_guide_broadcasting`

等式为:

.. math::
Out = X / Y
- :math:`X` :多维Tensor。
- :math:`Y` :多维Tensor。

参数:
- x(Tensor)- 多维Tensor。数据类型为float32 、float64、int32或int64。
- y(Tensor)- 多维Tensor。数据类型为float32 、float64、int32或int64。
- name(str,可选)- 操作的名称(可选,默认值为None)。更多信息请参见 :ref:`api_guide_Name`。


返回: 多维 Tensor, 数据类型与 ``x`` 相同,维度为广播后的形状。

返回类型: Tensor


**代码示例**

.. code-block:: python
import paddle
import numpy as np
paddle.disable_static()
np_x = np.array([2, 3, 4]).astype('float64')
np_y = np.array([1, 5, 2]).astype('float64')
x = paddle.to_tensor(np_x)
y = paddle.to_tensor(np_y)
z = paddle.divide(x, y)
print(z.numpy()) # [2., 0.6, 2.]
43 changes: 43 additions & 0 deletions doc/fluid/api_cn/tensor_cn/floor_divide_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.. _cn_api_tensor_floor_divide:

floor_divide
-------------------------------

.. py:function:: paddle.floor_divide(x, y, name=None)
该OP是逐元素整除算子,输入 ``x`` 与输入 ``y`` 逐元素整除,并将各个位置的输出元素保存到返回结果中。
输入 ``x`` 与输入 ``y`` 必须可以广播为相同形状, 关于广播规则,请参考 :ref:`use_guide_broadcasting`

等式为:

.. math::
Out = X // Y
- :math:`X` :多维Tensor。
- :math:`Y` :多维Tensor。

参数:
- x(Tensor)- 多维Tensor。数据类型为int32或int64。
- y(Tensor)- 多维Tensor。数据类型为int32或int64。
- name(str,可选)- 操作的名称(可选,默认值为None)。更多信息请参见 :ref:`api_guide_Name`。


返回: 多维 Tensor, 数据类型与 ``x`` 相同,维度为广播后的形状。

返回类型: Tensor


**代码示例**

.. code-block:: python
import paddle
import numpy as np
paddle.disable_static()
np_x = np.array([2, 3, 8, 7])
np_y = np.array([1, 5, 3, 3])
x = paddle.to_tensor(np_x)
y = paddle.to_tensor(np_y)
z = paddle.floor_divide(x, y)
print(z.numpy()) # [2, 0, 2, 2]
7 changes: 7 additions & 0 deletions doc/fluid/api_cn/tensor_cn/floor_mod_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. _cn_api_tensor_cn_floor_mod:

floor_mod
-------------------------------
:doc_source: paddle.tensor.remainder


7 changes: 7 additions & 0 deletions doc/fluid/api_cn/tensor_cn/mod_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. _cn_api_tensor_cn_mod:

mod
-------------------------------
:doc_source: paddle.tensor.remainder


42 changes: 42 additions & 0 deletions doc/fluid/api_cn/tensor_cn/remainder_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. _cn_api_tensor_remainder:

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

.. py:function:: paddle.remainder(x, y, name=None)
该OP是逐元素取模算子,输入 ``x`` 与输入 ``y`` 逐元素取模,并将各个位置的输出元素保存到返回结果中。
输入 ``x`` 与输入 ``y`` 必须可以广播为相同形状, 关于广播规则,请参考 :ref:`use_guide_broadcasting`

等式为:

.. math::
Out = X \% Y
- :math:`X` :多维Tensor。
- :math:`Y` :多维Tensor。

参数:
- x(Tensor)- 多维Tensor。数据类型为float32 、float64、int32或int64。
- y(Tensor)- 多维Tensor。数据类型为float32 、float64、int32或int64。
- name(str,可选)- 操作的名称(可选,默认值为None)。更多信息请参见 :ref:`api_guide_Name`。


返回: 多维 Tensor, 数据类型与 ``x`` 相同,维度为广播后的形状。

返回类型: Tensor


**代码示例**

.. code-block:: python
import paddle
import numpy as np
paddle.disable_static()
np_x = np.array([2, 3, 8, 7])
np_y = np.array([1, 5, 3, 3])
x = paddle.to_tensor(np_x)
y = paddle.to_tensor(np_y)
z = paddle.remainder(x, y)
print(z.numpy()) # [0, 3, 2, 1]

0 comments on commit 9cfbc97

Please sign in to comment.