Skip to content

Commit f8a49db

Browse files
[API Compatiblity] Update index_select, logical_* (#7402)
* fix docs * fix * refine
1 parent bf4fb5b commit f8a49db

File tree

5 files changed

+51
-20
lines changed

5 files changed

+51
-20
lines changed

docs/api/paddle/index_select_cn.rst

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,31 @@
33
index_select
44
-------------------------------
55

6-
.. py:function:: paddle.index_select(x, index, axis=0, name=None)
6+
.. py:function:: paddle.index_select(x, index, axis=0, name=None, *, out=None)
77
88
99
10-
沿着指定轴 ``axis`` 对输入 ``x`` 进行索引,取 ``index`` 中指定的相应项,创建并返回到一个新的 Tensor。这里 ``index`` 是一个 ``1-D`` Tensor。除 ``axis`` 轴外,返回的 Tensor 其余维度大小和输入 ``x`` 相等,``axis`` 维度的大小等于 ``index`` 的大小。
10+
沿着指定轴 ``axis`` 对输入 ``x`` 进行索引,取 ``index`` 中指定的相应项,创建并返回到一个新的 Tensor。这里 ``index`` 是一个 ``1-D`` Tensor。除 ``axis`` 轴外,返回的 Tensor 其余维度大小和输入 ``x`` 相等, ``axis`` 维度的大小等于 ``index`` 的大小。
11+
12+
.. note::
13+
别名支持: 参数名 ``input`` 可替代 ``x``, ``dim`` 可替代 ``axis``;
14+
参数顺序支持: 支持 PyTorch 参数顺序 ``(input, dim, index)`` 作为位置参数传入,可转换为 Paddle 顺序 ``(x, index, axis)``;
15+
如 ``(input=x, dim=1, index=idx)`` 等价于 ``(x=x, index=idx, axis=1)``, ``(x, 1, idx)`` 等价于 ``(x, idx, axis=1)``。
1116

1217
参数
1318
:::::::::
1419

15-
- **x** (Tensor)– 输入 Tensor。 ``x`` 的数据类型可以是 float16,float32,float64,int32,int64,complex64,complex128。
16-
- **index** (Tensor)– 包含索引下标的 1-D Tensor。
17-
- **axis** (int,可选) – 索引轴,若未指定,则默认选取第 0 维。
18-
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
20+
- **x** (Tensor) - 输入 Tensor。 ``x`` 的数据类型可以是 float16,float32,float64,int32,int64,complex64,complex128。
21+
别名: ``input``
22+
- **index** (Tensor) - 包含索引下标的 1-D Tensor。
23+
- **axis** (int,可选) - 索引轴,若未指定,则默认选取第 0 维。
24+
别名: ``dim``
25+
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
26+
27+
关键字参数
28+
:::::::::
29+
30+
- **out** (Tensor,可选) - 指定输出结果的 `Tensor`,默认值为 None。
1931

2032
返回
2133
:::::::::

docs/api/paddle/logical_and_cn.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ logical_and
1515

1616
.. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7
1717

18+
.. note::
19+
别名支持: 参数名 ``input`` 可替代 ``x``, ``other`` 可替代 ``y``。
20+
1821
参数
1922
::::::::::::
2023

21-
- **x** (Tensor)- 输入的 `Tensor`,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
22-
- **y** (Tensor)- 输入的 `Tensor`,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
23-
- **out** (Tensor,可选)- 指定算子输出结果的 `Tensor`,可以是程序中已经创建的任何 Tensor。默认值为 None,此时将创建新的 Tensor 来保存输出结果。
24-
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
24+
- **x** (Tensor) - 输入的 `Tensor`,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
25+
别名: ``input``
26+
- **y** (Tensor) - 输入的 `Tensor`,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
27+
别名: ``other``
28+
- **out** (Tensor,可选) - 指定算子输出结果的 `Tensor`,可以是程序中已经创建的任何 Tensor。默认值为 None,此时将创建新的 Tensor 来保存输出结果。
29+
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
2530

2631
返回
2732
::::::::::::

docs/api/paddle/logical_not_cn.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ logical_not
1313
.. math::
1414
Out = !X
1515
16+
.. note::
17+
别名支持: 参数名 ``input`` 可替代 ``x``。
18+
1619
参数
1720
::::::::::::
1821

19-
- **x** (Tensor)- 逻辑非运算的输入,是一个 Tensor,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
20-
- **out** (Tensor,可选)- 指定算子输出结果的 Tensor,可以是程序中已经创建的任何 Tensor。默认值为 None,此时将创建新的 Tensor 来保存输出结果。
21-
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
22+
- **x** (Tensor) - 逻辑非运算的输入,是一个 Tensor,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
23+
别名: ``input``
24+
- **out** (Tensor,可选) - 指定算子输出结果的 Tensor,可以是程序中已经创建的任何 Tensor。默认值为 None,此时将创建新的 Tensor 来保存输出结果。
25+
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
2226

2327
返回
2428
::::::::::::

docs/api/paddle/logical_or_cn.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ logical_or
1515

1616
.. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7
1717

18+
.. note::
19+
别名支持: 参数名 ``input`` 可替代 ``x``, ``other`` 可替代 ``y``。
20+
1821
参数
1922
::::::::::::
2023

21-
- **x** (Tensor)- 输入的 `Tensor`,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
24+
- **x** (Tensor) - 输入的 `Tensor`,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
25+
别名: ``input``
2226
- **y** (Tensor)- 输入的 `Tensor`,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
23-
- **out** (Tensor,可选)- 指定算子输出结果的 `Tensor`,可以是程序中已经创建的任何 Tensor。默认值为 None,此时将创建新的 Tensor 来保存输出结果。
24-
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
27+
别名: ``other``
28+
- **out** (Tensor,可选) - 指定算子输出结果的 `Tensor`,可以是程序中已经创建的任何 Tensor。默认值为 None,此时将创建新的 Tensor 来保存输出结果。
29+
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
2530

2631
返回
2732
::::::::::::

docs/api/paddle/logical_xor_cn.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ logical_xor
1515

1616
.. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7
1717

18+
.. note::
19+
别名支持: 参数名 ``input`` 可替代 ``x``, ``other`` 可替代 ``y``。
20+
1821
参数
1922
::::::::::::
2023

21-
- **x** (Tensor)- 输入的 `Tensor`,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
22-
- **y** (Tensor)- 输入的 `Tensor`,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
23-
- **out** (Tensor,可选)- 指定算子输出结果的 `Tensor`,可以是程序中已经创建的任何 Tensor。默认值为 None,此时将创建新的 Tensor 来保存输出结果。
24-
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
24+
- **x** (Tensor) - 输入的 `Tensor`,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
25+
别名: ``input``
26+
- **y** (Tensor) - 输入的 `Tensor`,支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
27+
别名: ``other``
28+
- **out** (Tensor,可选) - 指定算子输出结果的 `Tensor`,可以是程序中已经创建的任何 Tensor。默认值为 None,此时将创建新的 Tensor 来保存输出结果。
29+
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
2530

2631
返回
2732
::::::::::::

0 commit comments

Comments
 (0)