forked from mindspore-Ecosystem/mindspore
fix issues
This commit is contained in:
parent
918f4361d5
commit
c4a7cbead3
|
@ -12,6 +12,10 @@ mindspore.Tensor.amax
|
|||
返回:
|
||||
与输入的张量具有相同的数据类型的Tensor。
|
||||
|
||||
- 如果 `axis` 为(),且 `keep_dims` 为False,则输出一个0维Tensor,表示输入Tensor中所有元素的最大值。
|
||||
- 如果 `axis` 为int,取值为1,并且 `keep_dims` 为False,则输出的shape为 :math:`(x_0, x_2, ..., x_R)` 。
|
||||
- 如果 `axis` 为tuple(int)或list(int),取值为(1, 2),并且 `keep_dims` 为False,则输出Tensor的shape为 :math:`(x_0, x_3, ..., x_R)` 。
|
||||
|
||||
异常:
|
||||
- **TypeError** - `axis` 不是以下数据类型之一:int、Tuple或List。
|
||||
- **TypeError** - `keep_dims` 不是bool类型。
|
||||
|
|
|
@ -12,6 +12,10 @@ mindspore.Tensor.amin
|
|||
返回:
|
||||
与输入的张量具有相同的数据类型的Tensor。
|
||||
|
||||
- 如果 `axis` 为(),且 `keep_dims` 为False,则输出一个0维Tensor,表示输入Tensor中所有元素的最大值。
|
||||
- 如果 `axis` 为int,取值为1,并且 `keep_dims` 为False,则输出的shape为 :math:`(x_0, x_2, ..., x_R)` 。
|
||||
- 如果 `axis` 为tuple(int)或list(int),取值为(1, 2),并且 `keep_dims` 为False,则输出Tensor的shape为 :math:`(x_0, x_3, ..., x_R)` 。
|
||||
|
||||
异常:
|
||||
- **TypeError** - `axis` 不是以下数据类型之一:int、Tuple或List。
|
||||
- **TypeError** - `keep_dims` 不是bool类型。
|
||||
|
|
|
@ -12,6 +12,10 @@ mindspore.Tensor.mean
|
|||
返回:
|
||||
与输入的张量具有相同的数据类型的Tensor。
|
||||
|
||||
- 如果 `axis` 为(),且 `keep_dims` 为False,则输出一个0维Tensor,表示输入Tensor中所有元素的最大值。
|
||||
- 如果 `axis` 为int,取值为1,并且 `keep_dims` 为False,则输出的shape为 :math:`(x_0, x_2, ..., x_R)` 。
|
||||
- 如果 `axis` 为tuple(int)或list(int),取值为(1, 2),并且 `keep_dims` 为False,则输出Tensor的shape为 :math:`(x_0, x_3, ..., x_R)` 。
|
||||
|
||||
异常:
|
||||
- **TypeError** - `axis` 不是以下数据类型之一:int、Tuple或List。
|
||||
- **TypeError** - `keep_dims` 不是bool类型。
|
||||
|
|
|
@ -12,6 +12,10 @@ mindspore.Tensor.prod
|
|||
返回:
|
||||
与输入的张量具有相同的数据类型的Tensor。
|
||||
|
||||
- 如果 `axis` 为(),且 `keep_dims` 为False,则输出一个0维Tensor,表示输入Tensor中所有元素的最大值。
|
||||
- 如果 `axis` 为int,取值为1,并且 `keep_dims` 为False,则输出的shape为 :math:`(x_0, x_2, ..., x_R)` 。
|
||||
- 如果 `axis` 为tuple(int)或list(int),取值为(1, 2),并且 `keep_dims` 为False,则输出Tensor的shape为 :math:`(x_0, x_3, ..., x_R)` 。
|
||||
|
||||
异常:
|
||||
- **TypeError** - `axis` 不是以下数据类型之一:int、Tuple或List。
|
||||
- **TypeError** - `keep_dims` 不是bool类型。
|
||||
|
|
|
@ -5,22 +5,18 @@ mindspore.ops.RandomCategorical
|
|||
|
||||
从分类分布中抽取样本。
|
||||
|
||||
**参数:**
|
||||
参数:
|
||||
- **dtype** (mindspore.dtype) - 输出的类型。它的值必须是 mindspore.int16、mindspore.int32 和 mindspore.int64 之一。默认值:mindspore.int64。
|
||||
|
||||
- **dtype** (mindspore.dtype): 输出的类型。它的值必须是 mindspore.int16、mindspore.int32 和 mindspore.int64 之一。默认值:mindspore.int64。
|
||||
|
||||
**输入:**
|
||||
|
||||
- **logits** (Tensor): 输入Tensor。Shape为 :math:`(batch_size, num_classes)` 的二维Tensor。
|
||||
- **num_sample** (int): 要抽取的样本数。只允许使用常量值。
|
||||
- **seed** (int): 随机种子。只允许使用常量值。默认值:0。
|
||||
|
||||
**输出:**
|
||||
输入:
|
||||
- **logits** (Tensor) - 输入Tensor。Shape为 :math:`(batch_size, num_classes)` 的二维Tensor。
|
||||
- **num_sample** (int) - 要抽取的样本数。只允许使用常量值。
|
||||
- **seed** (int) - 随机种子。只允许使用常量值。默认值:0。
|
||||
|
||||
输出:
|
||||
- **output** (Tensor) - Shape为[batch_size, num_samples]的输出Tensor。
|
||||
|
||||
**异常:**
|
||||
|
||||
异常:
|
||||
- **TypeError** - 如果 `dtype` 不是以下之一:mindspore.int16、mindspore.int32、mindspore.int64。
|
||||
- **TypeError** - 如果 `logits` 不是Tensor。
|
||||
- **TypeError** - 如果 `num_sample` 或者 `seed` 不是 int。
|
||||
|
|
|
@ -15,7 +15,7 @@ mindspore.ops.ReduceMax
|
|||
- **axis** (Union[int, tuple(int), list(int)]) - 要减少的维度。默认值: (),缩小所有维度。只允许常量值。假设 `x` 的秩为r,取值范围[-r,r)。
|
||||
|
||||
输出:
|
||||
Tensor,shape与输入 `x` 相同。
|
||||
与输入 `x` 具有相同数据类型的Tensor。
|
||||
|
||||
- 如果 `axis` 为(),且 `keep_dims` 为False,则输出一个0维Tensor,表示输入Tensor中所有元素的最大值。
|
||||
- 如果 `axis` 为int,取值为1,并且 `keep_dims` 为False,则输出的shape为 :math:`(x_0, x_2, ..., x_R)` 。
|
||||
|
|
|
@ -15,7 +15,7 @@ mindspore.ops.ReduceMean
|
|||
- **axis** (Union[int, tuple(int), list(int)]) - 要减少的维度。默认值: (),缩小所有维度。只允许常量值。假设 `x` 的秩为r,取值范围[-r,r)。
|
||||
|
||||
输出:
|
||||
Tensor,shape与输入 `x` 相同。
|
||||
与输入 `x` 具有相同数据类型的Tensor。
|
||||
|
||||
- 如果 `axis` 为(),且 `keep_dims` 为False,则输出一个0维Tensor,表示输入Tensor中所有元素的平均值。
|
||||
- 如果 `axis` 为int,取值为1,并且 `keep_dims` 为False,则输出的shape为 :math:`(x_0, x_2, ..., x_R)` 。
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
- **axis** (Union[int, tuple(int), list(int)]) - 要减少的维度。默认值: (),缩小所有维度。只允许常量值。假设 `x` 的秩为r,取值范围[-r,r)。
|
||||
|
||||
输出:
|
||||
Tensor,shape与输入 `x` 相同。
|
||||
与输入 `x` 具有相同数据类型的Tensor。
|
||||
|
||||
- 如果 `axis` 为(),且 `keep_dims` 为False,则输出一个0维Tensor,表示输入Tensor中所有元素的最小值。
|
||||
- 如果 `axis` 为int,取值为1,并且 `keep_dims` 为False,则输出的shape为 :math:`(x_0, x_2, ..., x_R)` 。
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
- **axis** (Union[int, tuple(int), list(int)]) - 要减少的维度。默认值: (),缩小所有维度。只允许常量值。假设 `x` 的秩为r,取值范围[-r,r)。
|
||||
|
||||
输出:
|
||||
Tensor,shape与输入 `x` 相同。
|
||||
与输入 `x` 具有相同数据类型的Tensor。
|
||||
|
||||
- 如果 `axis` 为(),且 `keep_dims` 为False,则输出一个0维Tensor,表示输入Tensor中所有元素的乘积。
|
||||
- 如果 `axis` 为int,取值为1,并且 `keep_dims` 为False,则输出的shape为 :math:`(x_0, x_2, ..., x_R)` 。
|
||||
|
|
|
@ -1590,7 +1590,9 @@ class Tensor(Tensor_):
|
|||
|
||||
def mean(self, axis=(), keep_dims=False):
|
||||
"""
|
||||
Reduce a dimension of a tensor by averaging all elements in the dimension.
|
||||
Reduces a dimension of a tensor by averaging 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`.
|
||||
|
||||
Args:
|
||||
axis (Union[None, int, tuple(int), list(int)]): Dimensions of reduction.
|
||||
|
@ -1601,6 +1603,13 @@ class Tensor(Tensor_):
|
|||
Returns:
|
||||
Tensor, has the same data type as input tensor.
|
||||
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the product of all elements in the input tensor.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `axis` is not one of the following: int, tuple or list.
|
||||
TypeError: If `keep_dims` is not a bool.
|
||||
|
@ -1642,6 +1651,13 @@ class Tensor(Tensor_):
|
|||
Returns:
|
||||
Tensor, has the same data type as input tensor.
|
||||
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the product of all elements in the input tensor.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `axis` is not one of the following: int, tuple or list.
|
||||
TypeError: If `keep_dims` is not a bool.
|
||||
|
@ -1676,6 +1692,13 @@ class Tensor(Tensor_):
|
|||
Returns:
|
||||
Tensor, has the same data type as input tensor.
|
||||
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the product of all elements in the input tensor.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `axis` is not one of the following: int, tuple or list.
|
||||
TypeError: If `keep_dims` is not a bool.
|
||||
|
@ -1697,7 +1720,9 @@ class Tensor(Tensor_):
|
|||
|
||||
def prod(self, axis=(), keep_dims=False):
|
||||
"""
|
||||
Reduce a dimension of a tensor by product all elements in the dimension.
|
||||
Reduces a dimension of a tensor by product 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`.
|
||||
|
||||
Args:
|
||||
axis (Union[None, int, tuple(int), list(int)]): Dimensions of reduction.
|
||||
|
@ -1708,6 +1733,13 @@ class Tensor(Tensor_):
|
|||
Returns:
|
||||
Tensor, has the same data type as input tensor.
|
||||
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the product of all elements in the input tensor.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `axis` is not one of the following: int, tuple or list.
|
||||
TypeError: If `keep_dims` is not a bool.
|
||||
|
|
|
@ -4274,6 +4274,13 @@ def amin(x, axis=(), keep_dims=False):
|
|||
Returns:
|
||||
Tensor, has the same data type as input tensor.
|
||||
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the product of all elements in the input tensor.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `x` is not a Tensor.
|
||||
TypeError: If `axis` is not one of the following: int, tuple or list.
|
||||
|
@ -4343,6 +4350,13 @@ def amax(x, axis=(), keep_dims=False):
|
|||
Returns:
|
||||
Tensor, has the same data type as input tensor.
|
||||
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the product of all elements in the input tensor.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `x` is not a Tensor.
|
||||
TypeError: If `axis` is not one of the following: int, tuple or list.
|
||||
|
@ -4412,6 +4426,13 @@ def mean(x, axis=(), keep_dims=False):
|
|||
Returns:
|
||||
Tensor, has the same data type as input tensor.
|
||||
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the product of all elements in the input tensor.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `x` is not a Tensor.
|
||||
TypeError: If `axis` is not one of the following: int, tuple or list.
|
||||
|
@ -4483,6 +4504,13 @@ def prod(x, axis=(), keep_dims=False):
|
|||
Returns:
|
||||
Tensor, has the same data type as input tensor.
|
||||
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the product of all elements in the input tensor.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `x` is not a Tensor.
|
||||
TypeError: If `axis` is not one of the following: int, tuple or list.
|
||||
|
|
|
@ -618,17 +618,17 @@ class ReduceMean(_Reduce):
|
|||
- **x** (Tensor[Number]) - The input tensor. The dtype of the tensor to be reduced is number.
|
||||
:math:`(N,*)` where :math:`*` means, any number of additional dimensions, its rank should be less than 8.
|
||||
- **axis** (Union[int, tuple(int), list(int)]) - The dimensions to reduce. Default: (), reduce all dimensions.
|
||||
Only constant value is allowed. Must be in the range [-rank(`x`), rank(`x`)).
|
||||
Only constant value is allowed. Must be in the range [-r, r).
|
||||
|
||||
Outputs:
|
||||
Tensor, has the same dtype as the `x`.
|
||||
|
||||
- If axis is (), and keep_dims is False,
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the mean 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)`.
|
||||
- If axis is tuple(int) or list(int), set as (2, 3), and keep_dims is False,
|
||||
the shape of output is :math:`(x_1, x_4, ..., x_R)`.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int) or list(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `keep_dims` is not a bool.
|
||||
|
@ -903,17 +903,17 @@ class ReduceMax(_Reduce):
|
|||
- **x** (Tensor[Number]) - The input tensor. The dtype of the tensor to be reduced is number.
|
||||
:math:`(N,*)` where :math:`*` means, any number of additional dimensions, its rank should be less than 8.
|
||||
- **axis** (Union[int, tuple(int), list(int)]) - The dimensions to reduce. Default: (), reduce all dimensions.
|
||||
Only constant value is allowed. Must be in the range [-rank(x), rank(x)).
|
||||
Only constant value is allowed. Must be in the range [-r, r).
|
||||
|
||||
Outputs:
|
||||
Tensor, has the same dtype as the `x`.
|
||||
|
||||
- If axis is (), and keep_dims is False,
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the maximum 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)`.
|
||||
- If axis is tuple(int) or list(int), set as (2, 3), and keep_dims is False,
|
||||
the shape of output is :math:`(x_1, x_4, ..., x_R)`.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int) or list(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `keep_dims` is not a bool.
|
||||
|
@ -990,17 +990,17 @@ class ReduceMin(_Reduce):
|
|||
- **x** (Tensor[Number]) - The input tensor. The dtype of the tensor to be reduced is number.
|
||||
:math:`(N,*)` where :math:`*` means, any number of additional dimensions, its rank should be less than 8.
|
||||
- **axis** (Union[int, tuple(int), list(int)]) - The dimensions to reduce. Default: (), reduce all dimensions.
|
||||
Only constant value is allowed. Must be in the range [-rank( `x`), rank( `x` )).
|
||||
Only constant value is allowed. Must be in the range [-r, r).
|
||||
|
||||
Outputs:
|
||||
Tensor, has the same dtype as the `x`.
|
||||
|
||||
- If axis is (), and keep_dims is False,
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the minimum 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)`.
|
||||
- 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)`.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `keep_dims` is not a bool.
|
||||
|
@ -1113,17 +1113,17 @@ class ReduceProd(_Reduce):
|
|||
- **x** (Tensor[Number]) - The input tensor. The dtype of the tensor to be reduced is number.
|
||||
:math:`(N,*)` where :math:`*` means, any number of additional dimensions, its rank should be less than 8.
|
||||
- **axis** (Union[int, tuple(int), list(int)]) - The dimensions to reduce. Default: (), reduce all dimensions.
|
||||
Only constant value is allowed. Must be in the range [-rank( `x` ), rank( `x` )).
|
||||
Only constant value is allowed. Must be in the range [-r, r).
|
||||
|
||||
Outputs:
|
||||
Tensor, has the same dtype as the `x`.
|
||||
|
||||
- If axis is (), and keep_dims is False,
|
||||
- If `axis` is (), and `keep_dims` is False,
|
||||
the output is a 0-D tensor representing the product 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)`.
|
||||
- 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)`.
|
||||
- If `axis` is int, set as 1, and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
||||
- If `axis` is tuple(int), set as (1, 2), and `keep_dims` is False,
|
||||
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
||||
|
||||
Raises:
|
||||
TypeError: If `keep_dims` is not a bool.
|
||||
|
|
Loading…
Reference in New Issue