forked from mindspore-Ecosystem/mindspore
!49058 [API] Sync param names
Merge pull request !49058 from shaojunsong/sync0217
This commit is contained in:
commit
ec4d4bae7b
|
@ -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`。
|
||||
|
|
|
@ -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`。
|
||||
|
|
|
@ -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。
|
||||
|
|
|
@ -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。
|
||||
|
|
|
@ -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`.
|
||||
"""
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue