Skip to content

Commit bd2e708

Browse files
authored
[API compatibility] Update 13 API Docs for Parameter Aliases (PaddlePaddle#7389)
* [API compatibility] 13 api docs update of Decorator * [API compatibility] paddle.unbind * fix * fix * fix * fix white * fix codestyle * fix
1 parent 2b9a482 commit bd2e708

File tree

11 files changed

+53
-18
lines changed

11 files changed

+53
-18
lines changed

docs/api/paddle/concat_cn.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ concat
1414
:width: 500
1515
:alt: 图例
1616

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

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

2427
返回

docs/api/paddle/empty_like_cn.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ empty_like
88
99
根据参数 ``x`` 的 shape 和数据类型 ``dtype`` 创建未初始化的 Tensor。如果 ``dtype`` 为 None,则 Tensor 的数据类型与 ``x`` 相同。
1010

11+
.. note::
12+
别名支持: 参数名 ``input`` 可替代 ``x``,如 ``empty_like(input=tensor_x)`` 等价于 ``empty_like(x=tensor_x)`` 。
13+
1114
参数
1215
::::::::::::
1316

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

docs/api/paddle/full_cn.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ full
99
1010
创建形状大小为 ``shape`` 并且数据类型为 ``dtype`` 的 Tensor,其中元素值均为 ``fill_value`` 。
1111

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

docs/api/paddle/nn/functional/softmax_cn.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,14 @@ softmax
8080
[0.26762315, 0.26762315, 0.26762315, 0.26762315],
8181
[0.72747516, 0.72747516, 0.72747516, 0.72747516]]]
8282
83+
.. note::
84+
别名支持: 参数名 ``input`` 可替代 ``x``,参数名 ``dim`` 可替代 ``axis`` ,如 ``softmax(input=tensor_x, dim=1, ...)`` 等价于 ``softmax(x=tensor_x, axis=1, ...)`` 。
8385

8486
参数
8587
::::::::::
8688

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

docs/api/paddle/nonzero_cn.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
nonzero
44
-------------------------------
55

6-
.. py:function:: paddle.nonzero(x, as_tuple=False)
6+
.. py:function:: paddle.nonzero(x, as_tuple=False, *, out=None)
77
88
99
@@ -12,12 +12,20 @@ nonzero
1212
返回结果是一个 ``shape`` 等于 ``[z x n]`` 的 ``Tensor``,第 ``i`` 行代表输入中第 ``i`` 个非零元素的坐标;当 ``as_tuple = True`` 时,
1313
返回结果是由 ``n`` 个大小为 ``z`` 的 ``1-D Tensor`` 构成的元组,第 ``i`` 个 ``1-D Tensor`` 记录输入的非零元素在第 ``i`` 维的坐标。
1414

15+
.. note::
16+
别名支持: 参数名 ``input`` 可替代 ``x`` ,如 ``nonzero(input=tensor_x)`` 等价于 ``nonzero(x=tensor_x)`` 。
17+
1518
参数
1619
:::::::::
1720

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

24+
关键字参数
25+
:::::::::
26+
27+
- **out** (Tensor,可选) - 输出 Tensor。默认值为 None。
28+
2129

2230

2331
返回

docs/api/paddle/outer_cn.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ outer
1010

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

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

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

2023
返回

docs/api/paddle/pow_cn.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ pow
1313
1414
out = x^{y}
1515
16+
.. note::
17+
别名支持: 参数名 ``input`` 可替代 ``x``,参数名 ``exponent`` 可替代 ``y`` ,如 ``pow(input=2, exponent=1.1)`` 等价于 ``pow(x=2, y=1.1)`` 。
18+
1619
参数
1720
:::::::::
18-
- **x** (Tensor)- 多维 ``Tensor``,数据类型为 ``bfloat16`` 、 ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 或 ``int64`` 。
19-
- **y** (float|int|Tensor)- 如果类型是多维 ``Tensor``,其数据类型应该和 ``x`` 相同。
21+
- **x** (Tensor)- 多维 ``Tensor``,数据类型为 ``bfloat16`` 、 ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 或 ``int64`` 。别名: ``input``。
22+
- **y** (float|int|Tensor)- 如果类型是多维 ``Tensor``,其数据类型应该和 ``x`` 相同。别名: ``exponent``。
2023
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
2124

2225
返回

docs/api/paddle/reshape_cn.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@ reshape
2828
.. image:: ../../images/api_legend/reshape.png
2929
:alt: 图例
3030

31+
.. note::
32+
别名支持: 参数名 ``input`` 可替代 ``x``,如 ``reshape(input=tensor_x, ...)`` 等价于 ``reshape(x=tensor_x, ...)``。
33+
3134
参数
3235
::::::::::::
3336

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

3841
返回

docs/api/paddle/unbind_cn.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ unbind
66
.. py:function:: paddle.unbind(input, axis=0)
77
88
9+
.. note::
10+
别名支持: 参数名 ``dim`` 可替代 ``axis``,如 ``paddle.unbind(input=tensor_x, dim=0)`` 等价于 ``paddle.unbind(input=tensor_x, axis=0)`` 。
911

1012

1113
将输入 Tensor 按照指定的维度分割成多个子 Tensor。
1214

1315
参数
1416
:::::::::
1517
- **input** (Tensor) - 输入变量,数据类型为 float16、loat32、float64、int32、int64、complex64、complex128 的多维 Tensor。
16-
- **axis** (int32|int64,可选) - 数据类型为 int32 或 int64,表示需要分割的维度。如果 axis < 0,则划分的维度为 rank(input) + axis。默认值为 0。
18+
- **axis** (int32|int64,可选) - 数据类型为 int32 或 int64,表示需要分割的维度。如果 axis < 0,则划分的维度为 rank(input) + axis。默认值为 0。别名: ``dim``。
1719

1820
返回
1921
:::::::::

docs/api/paddle/where_cn.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ where
2020
.. note::
2121
``numpy.where(condition)`` 功能与 ``paddle.nonzero(condition, as_tuple=True)`` 相同,可以参考 :ref:`cn_api_paddle_nonzero`。
2222

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

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

3134
返回

0 commit comments

Comments
 (0)