!49058 [API] Sync param names

Merge pull request !49058 from shaojunsong/sync0217
This commit is contained in:
i-robot 2023-02-18 07:48:51 +00:00 committed by Gitee
commit ec4d4bae7b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 48 additions and 46 deletions

View File

@ -1,6 +1,6 @@
mindspore.Tensor.all
====================
.. py:method:: mindspore.Tensor.all(axis=(), keep_dims=False)
.. py:method:: mindspore.Tensor.all(axis=None, keep_dims=False)
详情请参考 :func:`mindspore.ops.all`

View File

@ -1,6 +1,6 @@
mindspore.Tensor.any
====================
.. py:method:: mindspore.Tensor.any(axis=(), keep_dims=False)
.. py:method:: mindspore.Tensor.any(axis=None, keep_dims=False)
详情请参考 :func:`mindspore.ops.any`

View File

@ -1,23 +1,23 @@
mindspore.ops.all
=================
.. py:function:: mindspore.ops.all(x, axis=(), keep_dims=False)
.. py:function:: mindspore.ops.all(input, axis=None, keep_dims=False)
默认情况下,通过对维度中所有元素进行“逻辑与”来减少 `x` 的维度。也可以沿轴减少 `x` 的维度。通过控制 `keep_dim` 来确定输出和输入的维度是否相同。
默认情况下,通过对维度中所有元素进行“逻辑与”来减少 `input` 的维度。也可以沿轴减少 `input` 的维度。通过控制 `keep_dim` 来确定输出和输入的维度是否相同。
参数:
- **x** (Tensor[bool]) - 输入Tensor其数据类型为bool型。shape是 :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度。秩应小于8。
- **axis** (Union[int, tuple(int), list(int)], 可选) - 要减少的维度。只允许常量值。假设 `x` 的秩为r取值范围[-r,r)。默认值:(),缩小所有维度。
- **input** (Tensor[bool]) - 输入Tensor其数据类型为bool型。shape是 :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度。秩应小于8。
- **axis** (Union[int, tuple(int), list(int)], 可选) - 要减少的维度。只允许常量值。假设 `input` 的秩为r取值范围[-r,r)。默认值:(),缩小所有维度。
- **keep_dims** (bool, 可选) - 如果为True则保留缩小的维度大小为1。否则移除维度。默认值False。
返回:
Tensor数据类型是bool。
- 如果 `axis`(),且 `keep_dims` 为False则输出一个零维Tensor表示输入Tensor中所有元素进行“逻辑与”。
- 如果 `axis` 为int取值为2并且 `keep_dims` 为False则输出的shape为 :math:`(x_1, x_3, ..., x_R)` 。
- 如果 `axis` 为tuple(int)或list(int),取值为(2, 3),并且 `keep_dims` 为False则输出Tensor的shape为 :math:`(x_1, x_4, ..., x_R)` 。
- 如果 `axis`None,且 `keep_dims` 为False则输出一个零维Tensor表示输入Tensor中所有元素进行“逻辑与”。
- 如果 `axis` 为int取值为2并且 `keep_dims` 为False则输出的shape为 :math:`(input_1, input_3, ..., input_R)` 。
- 如果 `axis` 为tuple(int)或list(int),取值为(2, 3),并且 `keep_dims` 为False则输出Tensor的shape为 :math:`(input_1, input_4, ..., input_R)` 。
异常:
- **TypeError** - `keep_dims` 不是bool类型。
- **TypeError** - `x` 不是Tensor。
- **TypeError** - `input` 不是Tensor。
- **TypeError** - `axis` 不是以下数据类型之一int、tuple或list。

View File

@ -1,23 +1,23 @@
mindspore.ops.any
=================
.. py:function:: mindspore.ops.any(x, axis=(), keep_dims=False)
.. py:function:: mindspore.ops.any(input, axis=None, keep_dims=False)
默认情况下,通过对维度中所有元素进行“逻辑或”来减少 `x` 的维度。也可以沿轴减少 `x` 的维度。通过控制 `keep_dim` 来确定输出和输入的维度是否相同。
默认情况下,通过对维度中所有元素进行“逻辑或”来减少 `input` 的维度。也可以沿轴减少 `input` 的维度。通过控制 `keep_dim` 来确定输出和输入的维度是否相同。
参数:
- **x** (Tensor[bool]) - 输入Tensor其数据类型为bool型。shape是 :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度。秩应小于8。
- **axis** (Union[int, tuple(int), list(int)], 可选) - 要减少的维度。只允许常量值。假设 `x` 的秩为r取值范围[-r,r)。默认值:(),缩小所有维度。
- **input** (Tensor[bool]) - 输入Tensor其数据类型为bool型。shape是 :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度。秩应小于8。
- **axis** (Union[int, tuple(int), list(int)], 可选) - 要减少的维度。只允许常量值。假设 `input` 的秩为r取值范围[-r,r)。默认值:(),缩小所有维度。
- **keep_dims** (bool, 可选) - 如果为True则保留缩小的维度大小为1。否则移除维度。默认值False。
返回:
Tensor数据类型是bool。
- 如果 `axis`(),且 `keep_dims` 为False则输出一个零维Tensor表示输入Tensor中所有元素进行“逻辑或”。
- 如果 `axis` 为int取值为2并且 `keep_dims` 为False则输出的shape为 :math:`(x_1, x_3, ..., x_R)` 。
- 如果 `axis` 为tuple(int)或list(int),取值为(2, 3),并且 `keep_dims` 为False则输出Tensor的shape为 :math:`(x_1, x_4, ..., x_R)` 。
- 如果 `axis`None,且 `keep_dims` 为False则输出一个零维Tensor表示输入Tensor中所有元素进行“逻辑或”。
- 如果 `axis` 为int取值为2并且 `keep_dims` 为False则输出的shape为 :math:`(input_1, input_3, ..., input_R)` 。
- 如果 `axis` 为tuple(int)或list(int),取值为(2, 3),并且 `keep_dims` 为False则输出Tensor的shape为 :math:`(input_1, input_4, ..., input_R)` 。
异常:
- **TypeError** - `keep_dims` 不是bool类型。
- **TypeError** - `x` 不是Tensor。
- **TypeError** - `input` 不是Tensor。
- **TypeError** - `axis` 不是以下数据类型之一int、tuple或list。

View File

@ -862,7 +862,7 @@ class Tensor(Tensor_):
self._init_check()
return tensor_operator_registry.get('adjoint')(self)
def all(self, axis=(), keep_dims=False):
def all(self, axis=None, keep_dims=False):
r"""
For details, please refer to :func:`mindspore.ops.all`.
"""
@ -878,7 +878,7 @@ class Tensor(Tensor_):
self._init_check()
return tensor_operator_registry.get('angle')(self)
def any(self, axis=(), keep_dims=False):
def any(self, axis=None, keep_dims=False):
r"""
For details, please refer to :func:`mindspore.ops.any`.
"""

View File

@ -8581,34 +8581,34 @@ def kron(x, y):
return result
def all(x, axis=(), keep_dims=False):
def all(input, axis=None, keep_dims=False):
r"""
Reduces a dimension of `x` by the "logicalAND" of all elements in the dimension, by default. And also can
reduce a dimension of `x` along the axis. Determine whether the dimensions of the output and input are the same by
controlling `keep_dims`.
Reduces a dimension of `input` by the "logicalAND" of all elements in the dimension, by default. And also can
reduce a dimension of `input` along the axis. Determine whether the dimensions of the output and input are the same
by controlling `keep_dims`.
Args:
x (Tensor[bool]): The input Tensor. The dtype of the Tensor is bool.
input (Tensor[bool]): The input Tensor. The dtype of the Tensor is bool.
:math:`(N,*)` where :math:`*` means, any number of additional dimensions, its rank should be less than 8.
axis (Union[int, tuple(int), list(int)], optional): The dimensions to reduce.
Only constant value is allowed. Supposed the rank of `x` is r,
axis must be in the range [-rank(x), rank(x)). Default: (), all dimensions are reduced.
Only constant value is allowed. Supposed the rank of `input` is r,
axis must be in the range [-rank(input), rank(input)). Default: None, all dimensions are reduced.
keep_dims (bool, optional): If true, keep these reduced dimensions and the length is 1.
If false, don't keep these dimensions. Default : False.
Returns:
Tensor, the dtype is bool.
- If axis is (), and keep_dims is False,
- If axis is None, and keep_dims is False,
the output is a 0-D Tensor representing the "logical and" of all elements in the input Tensor.
- If axis is int, set as 2, and keep_dims is False,
the shape of output is :math:`(x_1, x_3, ..., x_R)`.
the shape of output is :math:`(input_1, input_3, ..., input_R)`.
- If axis is tuple(int), set as (2, 3), and keep_dims is False,
the shape of output is :math:`(x_1, x_4, ..., x_R)`.
the shape of output is :math:`(input_1, input_4, ..., input_R)`.
Raises:
TypeError: If `keep_dims` is not a bool.
TypeError: If `x` is not a Tensor.
TypeError: If `input` is not a Tensor.
TypeError: If `axis` is not one of the following: int, tuple or list.
Supported Platforms:
@ -8631,38 +8631,39 @@ def all(x, axis=(), keep_dims=False):
>>> print(output)
[False True]
"""
return _get_cache_prim(P.ReduceAll)(keep_dims)(x, axis)
if axis is None:
axis = ()
return _get_cache_prim(P.ReduceAll)(keep_dims)(input, axis)
def any(x, axis=(), keep_dims=False):
def any(input, axis=None, keep_dims=False):
r"""
Reduces a dimension of `x` by the "logical OR" of all elements in the dimension, by default. And also can
reduce a dimension of `x` along the axis. Determine whether the dimensions of the output and input are the same by
controlling `keep_dims`.
Reduces a dimension of `input` by the "logical OR" of all elements in the dimension, by default. And also can
reduce a dimension of `input` along the axis. Determine whether the dimensions of the output and input are the same
by controlling `keep_dims`.
Args:
x (Tensor[bool]): The input Tensor. The dtype of the Tensor is bool.
input (Tensor[bool]): The input Tensor. The dtype of the Tensor is bool.
:math:`(N,*)` where :math:`*` means, any number of additional dimensions, its rank should be less than 8.
axis (Union[int, tuple(int), list(int)], optional): The dimensions to reduce.
Only constant value is allowed. Supposed the rank of `x` is r,
axis must be in the range [-rank(x), rank(x)). Default: (), all dimensions are reduced.
Only constant value is allowed. Supposed the rank of `input` is r,
axis must be in the range [-rank(input), rank(input)). Default: None, all dimensions are reduced.
keep_dims (bool, optional): If true, keep these reduced dimensions and the length is 1.
If false, don't keep these dimensions. Default : False.
Returns:
Tensor, the dtype is bool.
- If axis is (), and keep_dims is False,
- If axis is None, and keep_dims is False,
the output is a 0-D Tensor representing the "logical or" of all elements in the input Tensor.
- If axis is int, set as 2, and keep_dims is False,
the shape of output is :math:`(x_1, x_3, ..., x_R)`.
the shape of output is :math:`(input_1, input_3, ..., input_R)`.
- If axis is tuple(int), set as (2, 3), and keep_dims is False,
the shape of output is :math:`(x_1, x_4, ..., x_R)`.
the shape of output is :math:`(input_1, input_4, ..., input_R)`.
Raises:
TypeError: If `keep_dims` is not a bool.
TypeError: If `x` is not a Tensor.
TypeError: If `input` is not a Tensor.
TypeError: If `axis` is not one of the following: int, tuple or list.
Supported Platforms:
@ -8685,8 +8686,9 @@ def any(x, axis=(), keep_dims=False):
>>> print(output)
[True True]
"""
return _get_cache_prim(P.ReduceAny)(keep_dims)(x, axis)
if axis is None:
axis = ()
return _get_cache_prim(P.ReduceAny)(keep_dims)(input, axis)
def remainder(x, y):