Skip to content

[API compatibility] Update 13 API Docs for Parameter Aliases #7389

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions docs/api/paddle/concat_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ concat
:width: 500
:alt: 图例

.. note::
别名支持: 参数名 ``tensors`` 可替代 ``x``,参数名 ``dim`` 可替代 ``axis`` ,如 ``concat(tensors=tensor_x, dim=1, ...)`` 等价于 ``concat(x=tensor_x, axis=1, ...)`` 。

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

- **x** (list|tuple) - 待联结的 Tensor list 或者 Tensor tuple,支持的数据类型为:bool、float16、bfloat16、float32、float64、int8、uint8、int16、uint16、int32、int64、complex64、complex128, ``x`` 中所有 Tensor 的数据类型应该一致。
``别名: tensors``
- **axis** (int|Tensor,可选) - 指定对输入 ``x`` 进行运算的轴,可以是整数或者形状为[]的 0-D Tensor,数据类型为 int32 或者 int64。 ``axis`` 的有效范围是 [-R, R),R 是输入 ``x`` 中 Tensor 的维度,``axis`` 为负值时与 :math:`axis + R` 等价。默认值为 0。
``别名: dim``
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
Expand Down
4 changes: 4 additions & 0 deletions docs/api/paddle/empty_like_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ empty_like

根据参数 ``x`` 的 shape 和数据类型 ``dtype`` 创建未初始化的 Tensor。如果 ``dtype`` 为 None,则 Tensor 的数据类型与 ``x`` 相同。

.. note::
别名支持: 参数名 ``input`` 可替代 ``x``,如 ``empty_like(input=tensor_x)`` 等价于 ``empty_like(x=tensor_x)`` 。

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

- **x** (Tensor) – 输入 Tensor,输出 Tensor 和 x 具有相同的形状,x 的数据类型可以是 bool、float16、float32、float64、int32、int64。
``别名: input``
- **dtype** (np.dtype|str,可选)- 输出变量的数据类型,可以是 bool、float16、float32、float64、int32、int64。若参数为 None,则输出变量的数据类型和输入变量相同,默认值为 None。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

Expand Down
4 changes: 4 additions & 0 deletions docs/api/paddle/full_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ full

创建形状大小为 ``shape`` 并且数据类型为 ``dtype`` 的 Tensor,其中元素值均为 ``fill_value`` 。

.. note::
别名支持: 参数名 ``size`` 可替代 ``shape``,如 ``full(size=[2, 3], …)`` 等价于 ``full(shape=[2, 3], …)`` 。

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

- **shape** (list|tuple|Tensor) – 指定创建 Tensor 的形状(shape),数据类型为 int32 或者 int64。如果 ``shape`` 是一个 list 或 tuple ,它的每个元素应该是整数或者是形状为[]的 0-D Tensor 。如果 ``shape`` 是一个 Tensor ,它应该是一个表示 list 的 1-D 张量。
``别名: size``
- **fill_value** (bool|float|int|Tensor) - 用于初始化输出 Tensor 的常量数据的值。如果 fill_value 是一个 Tensor ,它应该是一个表示标量的 0-D Tensor。注意:该参数不可超过输出变量数据类型的表示范围。
- **dtype** (np.dtype|str,可选)- 输出变量的数据类型,可以是 float16、float32、float64、int32、int64。如果 dytpe 为 None,则创建的 Tensor 的数据类型为 float32。默认值为 None。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
Expand Down
4 changes: 4 additions & 0 deletions docs/api/paddle/linalg/norm_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ norm
| float | | {(1 / porder)} |
+----------------+--------------------------------+--------------------------------+

.. note::
别名支持: 参数名 ``input`` 可替代 ``x``,参数名 ``dim`` 可替代 ``axis`` ,如 ``norm(input=tensor_x, dim=1, ...)`` 等价于 ``norm(x=tensor_x, axis=1, ...)`` 。

参数
:::::::::

- **x** (Tensor) - 输入 Tensor。维度为多维,数据类型为 float32 或 float64。
``别名: input``
- **p** (int|float|string,可选) - 范数(ord)的种类。目前支持的值为 `fro`、`nuc`、`inf`、`-inf`、`0`、`1`、`2`,和任何实数 p 对应的 p 范数。默认值为 None。
- **axis** (int|list|tuple,可选) - 使用范数计算的轴。如果 ``axis`` 为 None,则忽略 input 的维度,将其当做向量来计算。如果 ``axis`` 为 int 或者只有一个元素的 list|tuple,``norm`` API 会计算输入 Tensor 的向量范数。如果 axis 为包含两个元素的 list,API 会计算输入 Tensor 的矩阵范数。当 ``axis < 0`` 时,实际的计算维度为 rank(input) + axis。默认值为 `None` 。
``别名: dim``
- **keepdim** (bool,可选) - 是否在输出的 Tensor 中保留和输入一样的维度,默认值为 False。当 :attr:`keepdim` 为 False 时,输出的 Tensor 会比输入 :attr:`input` 的维度少一些。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

Expand Down
4 changes: 4 additions & 0 deletions docs/api/paddle/nn/functional/softmax_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,16 @@ softmax
[0.26762315, 0.26762315, 0.26762315, 0.26762315],
[0.72747516, 0.72747516, 0.72747516, 0.72747516]]]

.. note::
别名支持: 参数名 ``input`` 可替代 ``x``,参数名 ``dim`` 可替代 ``axis`` ,如 ``softmax(input=tensor_x, dim=1, ...)`` 等价于 ``softmax(x=tensor_x, axis=1, ...)`` 。

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

- **x** (Tensor) - 输入的 ``Tensor``,数据类型为 bfloat16 、 float16 、 float32 或 float64。
``别名: input``
- **axis** (int,可选) - 指定对输入 :attr:`x` 进行运算的轴。:attr:`axis` 的有效范围是 :math:`[-D, D)`,:math:`D` 是输入 :attr:`x` 的维度,:attr:`axis` 为负值时与 :math:`axis + D` 等价。默认值为 -1。
``别名: dim``
- **dtype** (str,可选) - 输出 `Tensor` 的数据类型,支持 bfloat16、 float16、 float32、float64。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

Expand Down
7 changes: 6 additions & 1 deletion docs/api/paddle/nonzero_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
nonzero
-------------------------------

.. py:function:: paddle.nonzero(x, as_tuple=False)
.. py:function:: paddle.nonzero(x, as_tuple=False, *, out=None)



Expand All @@ -12,11 +12,16 @@ nonzero
返回结果是一个 ``shape`` 等于 ``[z x n]`` 的 ``Tensor``,第 ``i`` 行代表输入中第 ``i`` 个非零元素的坐标;当 ``as_tuple = True`` 时,
返回结果是由 ``n`` 个大小为 ``z`` 的 ``1-D Tensor`` 构成的元组,第 ``i`` 个 ``1-D Tensor`` 记录输入的非零元素在第 ``i`` 维的坐标。

.. note::
别名支持: 参数名 ``input`` 可替代 ``x`` ,如 ``nonzero(input=tensor_x)`` 等价于 ``nonzero(x=tensor_x)`` 。

参数
:::::::::

- **x** (Tensor)– 输入的 Tensor。
``别名: input``
- **as_tuple** (bool,可选) - 返回格式。是否以 ``1-D Tensor`` 构成的元组格式返回。
- **out** (Tensor,可选) - 输出 Tensor。



Expand Down
3 changes: 2 additions & 1 deletion docs/api/paddle/ones_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ ones
参数
:::::::::

- **shape** (tuple|list|Tensor) - 要创建的 Tensor 的形状,``shape`` 的数据类型为 int32 或 int64。若 shape 是 list 或 tuple 类型,其元素应为整数或零维张量,若 shape 是 Tensor 类型,其元素应为表示列表的一维张量。
- **shape** (tuple|list|Tensor|*shape) - 要创建的 Tensor 的形状,``shape`` 的数据类型为 int32 或 int64。若 shape 是 list 或 tuple 类型,其元素应为整数或零维张量,若 shape 是 Tensor 类型,其元素应为表示列表的一维张量。 如果是 ``*shape``,则直接以可变长参数形式传入整数(例如 ``ones(2, 3)`` )。
``别名: size``
- **dtype** (np.dtype|str,可选) - 要创建的 Tensor 的数据类型,可以为 bool、float16、float32、float64、int32 或 int64。如果 ``dtype`` 为 None,那么数据类型为 float32。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

Expand Down
5 changes: 5 additions & 0 deletions docs/api/paddle/outer_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ outer

对于 1 维 Tensor 正常计算外积,对于大于 1 维的 Tensor 先展平为 1 维再计算外积。

.. note::
别名支持: 参数名 ``input`` 可替代 ``x``,参数名 ``vec2`` 可替代 ``y`` ,如 ``outer(input=tensor_x, vec2=tensor_y, ...)`` 等价于 ``outer(x=tensor_x, y=tensor_y, ...)`` 。

参数
:::::::::

- **x** (Tensor) - 一个 N 维 Tensor 或者标量 Tensor。
``别名: input``
- **y** (Tensor) - 一个 N 维 Tensor 或者标量 Tensor。
``别名: vec2``
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
Expand Down
5 changes: 5 additions & 0 deletions docs/api/paddle/pow_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ pow
out = x^{y}
.. note::
别名支持: 参数名 ``input`` 可替代 ``x``,参数名 ``exponent`` 可替代 ``y`` ,如 ``pow(input=2, exponent=1.1)`` 等价于 ``pow(x=2, y=1.1)`` 。

参数
:::::::::
- **x** (Tensor)- 多维 ``Tensor``,数据类型为 ``bfloat16`` 、 ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 或 ``int64`` 。
``别名: input``
- **y** (float|int|Tensor)- 如果类型是多维 ``Tensor``,其数据类型应该和 ``x`` 相同。
``别名: exponent``
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
Expand Down
3 changes: 2 additions & 1 deletion docs/api/paddle/randn_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ randn

参数
::::::::::
- **shape** (list|tuple|Tensor) - 生成的随机 Tensor 的形状。如果 ``shape`` 是 list、tuple,则其中的元素可以是 int,或者是形状为[]且数据类型为 int32、int64 的 0-D Tensor。如果 ``shape`` 是 Tensor,则是数据类型为 int32、int64 的 1-D Tensor。
- **shape** (list|tuple|Tensor|*shape) - 生成的随机 Tensor 的形状。如果 ``shape`` 是 list、tuple,则其中的元素可以是 int,或者是形状为[]且数据类型为 int32、int64 的 0-D Tensor。如果 ``shape`` 是 Tensor,则是数据类型为 int32、int64 的 1-D Tensor。 如果是 ``*shape``,则直接以可变长参数形式传入整数(例如 ``randn(2, 3)``)。
``别名: size``
- **dtype** (str|np.dtype,可选) - 输出 Tensor 的数据类型,支持 float16、bfloat16、float32、float64、complex64、complex128。当该参数值为 None 时,输出 Tensor 的数据类型为 float32。默认值为 None。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

Expand Down
6 changes: 5 additions & 1 deletion docs/api/paddle/reshape_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ reshape
.. image:: ../../images/api_legend/reshape.png
:alt: 图例

.. note::
别名支持: 参数名 ``input`` 可替代 ``x``,如 ``reshape(input=tensor_x, ...)`` 等价于 ``reshape(x=tensor_x, ...)``。

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

- **x** (Tensor) - N-D ``Tensor``,数据类型为 ``float16``, ``float32``, ``float64``, ``int16``, ``int32``, ``int64``, ``int8``, ``uint8``, ``complex64``, ``complex128``, ``bfloat16`` 或 ``bool``。
- **shape** (list|tuple|Tensor) - 数据类型是 ``int32``。定义目标形状。目标形状最多只能有一个维度为-1。如果 ``shape`` 的类型是 list 或 tuple,它的元素可以是整数或者形状为[]的 ``Tensor``。如果 ``shape`` 的类型是 ``Tensor``,则是 1-D 的 ``Tensor``。
``别名: input``
- **shape** (list|tuple|Tensor|*shape) - 数据类型是 ``int32``。定义目标形状。目标形状最多只能有一个维度为-1。如果 ``shape`` 的类型是 list 或 tuple,它的元素可以是整数或者形状为[]的 ``Tensor``。如果 ``shape`` 的类型是 ``Tensor``,则是 1-D 的 ``Tensor``。 如果是 ``*shape``,则直接以可变长参数形式传入整数(例如 ``reshape(tensor_x, 2, 3)``)。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
Expand Down
5 changes: 5 additions & 0 deletions docs/api/paddle/where_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ where
.. note::
``numpy.where(condition)`` 功能与 ``paddle.nonzero(condition, as_tuple=True)`` 相同,可以参考 :ref:`cn_api_paddle_nonzero`。

.. note::
别名支持: 参数名 ``input`` 可替代 ``x``,参数名 ``other`` 可替代 ``y`` ,如 ``paddle.where(condition, input=x, other=y)`` 等价于 ``paddle.where(condition, x=x, y=y)`` 。

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

- **condition** (Tensor) - 选择 ``x`` 或 ``y`` 元素的条件。在为 True(非零值)时,选择 ``x``,否则选择 ``y``。
- **x** (Tensor|scalar,可选) - 条件为 True 时选择的 Tensor 或 scalar,数据类型为 bfloat16、 float16、float32、float64、int32 或 int64。``x`` 和 ``y`` 必须都给出或者都不给出。
``别名: input``
- **y** (Tensor|scalar,可选) - 条件为 False 时选择的 Tensor 或 scalar,数据类型为 bfloat16、float16、float32、float64、int32 或 int64。``x`` 和 ``y`` 必须都给出或者都不给出。
``别名: other``
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
Expand Down
4 changes: 4 additions & 0 deletions docs/api/paddle/zeros_like_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ zeros_like

返回一个和 ``x`` 具有相同的形状的全零 Tensor,数据类型为 ``dtype`` 或者和 ``x`` 相同。

.. note::
别名支持: 参数名 ``input`` 可替代 ``x``,如 ``zeros_like(input=x, ...)`` 等价于 ``zeros_like(x=x, ...)``。

参数
::::::::::
- **x** (Tensor) – 输入的多维 Tensor,数据类型可以是 bool,float16, float32,float64,int32,int64。输出 Tensor 的形状和 ``x`` 相同。如果 ``dtype`` 为 None,则输出 Tensor 的数据类型与 ``x`` 相同。
``别名: input``
- **dtype** (str|np.dtype,可选) - 输出 Tensor 的数据类型,支持 bool,float16, float32,float64,int32,int64。当该参数值为 None 时,输出 Tensor 的数据类型与 ``x`` 相同。默认值为 None。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

Expand Down