forked from mindspore-Ecosystem/mindspore
!12535 add raises description for Cast, Diag, Eye, Fill etc. operators
From: @wangshuide2020 Reviewed-by: @liangchenghui Signed-off-by: @liangchenghui
This commit is contained in:
commit
2e7a785d44
|
@ -140,9 +140,6 @@ class ExpandDims(PrimitiveWithInfer):
|
||||||
If the specified axis is a negative number, the index is counted
|
If the specified axis is a negative number, the index is counted
|
||||||
backward from the end and starts at 1.
|
backward from the end and starts at 1.
|
||||||
|
|
||||||
Raises:
|
|
||||||
ValueError: If axis is not an integer or not in the valid range.
|
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
|
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
|
||||||
- **axis** (int) - Specifies the dimension index at which to expand
|
- **axis** (int) - Specifies the dimension index at which to expand
|
||||||
|
@ -153,6 +150,9 @@ class ExpandDims(PrimitiveWithInfer):
|
||||||
Tensor, the shape of tensor is :math:`(1, x_1, x_2, ..., x_R)` if the
|
Tensor, the shape of tensor is :math:`(1, x_1, x_2, ..., x_R)` if the
|
||||||
value of `axis` is 0. It has the same type as `input_x`.
|
value of `axis` is 0. It has the same type as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: If `axis` is not an int or not in the valid range.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -205,6 +205,9 @@ class DType(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
mindspore.dtype, the data type of a tensor.
|
mindspore.dtype, the data type of a tensor.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -231,10 +234,6 @@ class SameTypeShape(PrimitiveWithInfer):
|
||||||
"""
|
"""
|
||||||
Checks whether the data type and shape of two tensors are the same.
|
Checks whether the data type and shape of two tensors are the same.
|
||||||
|
|
||||||
Raises:
|
|
||||||
TypeError: If the data types of two tensors are not the same.
|
|
||||||
ValueError: If the shapes of two tensors are not the same.
|
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
|
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
|
||||||
- **input_y** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_S)`.
|
- **input_y** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_S)`.
|
||||||
|
@ -243,6 +242,10 @@ class SameTypeShape(PrimitiveWithInfer):
|
||||||
Tensor, the shape of tensor is :math:`(x_1, x_2, ..., x_R)`,
|
Tensor, the shape of tensor is :math:`(x_1, x_2, ..., x_R)`,
|
||||||
if data type and shape of `input_x` and `input_y` are the same.
|
if data type and shape of `input_x` and `input_y` are the same.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If the data types of `input_x` and `input_y` are not the same.
|
||||||
|
ValueError: If the shapes of `input_x` and `input_y` are not the same.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -287,6 +290,10 @@ class Cast(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape of tensor is the same as `input_x`, :math:`(x_1, x_2, ..., x_R)`.
|
Tensor, the shape of tensor is the same as `input_x`, :math:`(x_1, x_2, ..., x_R)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is neither Tensor nor Number.
|
||||||
|
TypeError: If `type` is not a Number.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -363,6 +370,9 @@ class IsSubClass(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
bool, the check result.
|
bool, the check result.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `sub_type` or `type_` is not a Type.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -402,6 +412,9 @@ class IsInstance(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
bool, the check result.
|
bool, the check result.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `type_` is not a Type.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -439,11 +452,6 @@ class Reshape(PrimitiveWithInfer):
|
||||||
"""
|
"""
|
||||||
Reshapes the input tensor with the same values based on a given shape tuple.
|
Reshapes the input tensor with the same values based on a given shape tuple.
|
||||||
|
|
||||||
Raises:
|
|
||||||
ValueError: Given a shape tuple, if it has several -1; or if the product
|
|
||||||
of its elements is less than or equal to 0 or cannot be divided by the product
|
|
||||||
of the input tensor shape; or if it does not match the input's array size.
|
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
|
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
|
||||||
- **input_shape** (tuple[int]) - The input tuple is constructed by multiple
|
- **input_shape** (tuple[int]) - The input tuple is constructed by multiple
|
||||||
|
@ -452,6 +460,11 @@ class Reshape(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape of tensor is :math:`(y_1, y_2, ..., y_S)`.
|
Tensor, the shape of tensor is :math:`(y_1, y_2, ..., y_S)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: Given a shape tuple, if it has several -1; or if the product
|
||||||
|
of its elements is less than or equal to 0 or cannot be divided by the product
|
||||||
|
of the input tensor shape; or if it does not match the input's array size.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -544,6 +557,9 @@ class Shape(PrimitiveWithInfer):
|
||||||
tuple[int], the output tuple is constructed by multiple integers,
|
tuple[int], the output tuple is constructed by multiple integers,
|
||||||
:math:`(x_1, x_2, ..., x_R)`.
|
:math:`(x_1, x_2, ..., x_R)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -577,6 +593,9 @@ class DynamicShape(Primitive):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor[int], 1-dim Tensor of type int32
|
Tensor[int], 1-dim Tensor of type int32
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -602,9 +621,6 @@ class Squeeze(PrimitiveWithInfer):
|
||||||
Note:
|
Note:
|
||||||
The dimension index starts at 0 and must be in the range `[-input.ndim, input.ndim`.
|
The dimension index starts at 0 and must be in the range `[-input.ndim, input.ndim`.
|
||||||
|
|
||||||
Raises:
|
|
||||||
ValueError: If the corresponding dimension of the specified axis does not equal to 1.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
axis (Union[int, tuple(int)]): Specifies the dimension indexes of shape to be removed, which will remove
|
axis (Union[int, tuple(int)]): Specifies the dimension indexes of shape to be removed, which will remove
|
||||||
all the dimensions that are equal to 1. If specified, it must be int32 or int64.
|
all the dimensions that are equal to 1. If specified, it must be int32 or int64.
|
||||||
|
@ -619,6 +635,7 @@ class Squeeze(PrimitiveWithInfer):
|
||||||
Raises:
|
Raises:
|
||||||
TypeError: If `axis` is neither an int nor tuple.
|
TypeError: If `axis` is neither an int nor tuple.
|
||||||
TypeError: If `axis` is a tuple whose elements are not all int.
|
TypeError: If `axis` is a tuple whose elements are not all int.
|
||||||
|
ValueError: If the corresponding dimension of the specified axis does not equal to 1.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
@ -678,6 +695,10 @@ class Transpose(PrimitiveWithInfer):
|
||||||
Tensor, the type of output tensor is the same as `input_x` and the shape of output tensor is decided by the
|
Tensor, the type of output tensor is the same as `input_x` and the shape of output tensor is decided by the
|
||||||
shape of `input_x` and the value of `input_perm`.
|
shape of `input_x` and the value of `input_perm`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_perm` is not a tuple.
|
||||||
|
ValueError: If length of shape of `input_x` is not equal to length of shape of `input_perm`.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -746,6 +767,9 @@ class Unique(Primitive):
|
||||||
ascending order. `idx` is a tensor containing indices of elements in
|
ascending order. `idx` is a tensor containing indices of elements in
|
||||||
the input corresponding to the output tensor.
|
the input corresponding to the output tensor.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -792,6 +816,9 @@ class Gather(PrimitiveWithCheck):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape of tensor is :math:`(z_1, z_2, ..., z_N)`.
|
Tensor, the shape of tensor is :math:`(z_1, z_2, ..., z_N)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `axis` is not an int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -860,6 +887,9 @@ class SparseGatherV2(Gather):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape of tensor is :math:`(z_1, z_2, ..., z_N)`.
|
Tensor, the shape of tensor is :math:`(z_1, z_2, ..., z_N)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `axis` is not an int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -889,6 +919,10 @@ class Padding(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape of tensor is :math:`(z_1, z_2, ..., z_N)`.
|
Tensor, the shape of tensor is :math:`(z_1, z_2, ..., z_N)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `pad_dim_size` is not an int.
|
||||||
|
ValueError: If `pad_dim_size` is less than 1.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -934,6 +968,10 @@ class UniqueWithPad(PrimitiveWithInfer):
|
||||||
- y (Tensor) - The unique elements filled with pad_num, the shape and type same as x.
|
- y (Tensor) - The unique elements filled with pad_num, the shape and type same as x.
|
||||||
- idx (Tensor) - The index of each value of x in the unique output y, the shape and type same as x.
|
- idx (Tensor) - The index of each value of x in the unique output y, the shape and type same as x.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `x` is neither int32 nor int64.
|
||||||
|
ValueError: If length of shape of `x` is not equal to 1.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``CPU``
|
``Ascend`` ``CPU``
|
||||||
|
|
||||||
|
@ -970,10 +1008,6 @@ class Split(PrimitiveWithCheck):
|
||||||
axis (int): Index of the split position. Default: 0.
|
axis (int): Index of the split position. Default: 0.
|
||||||
output_num (int): The number of output tensors. Must be positive int. Default: 1.
|
output_num (int): The number of output tensors. Must be positive int. Default: 1.
|
||||||
|
|
||||||
Raises:
|
|
||||||
ValueError: If `axis` is out of the range [-len(`input_x.shape`), len(`input_x.shape`)),
|
|
||||||
or if the `output_num` is less than or equal to 0.
|
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
|
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
|
||||||
|
|
||||||
|
@ -981,6 +1015,11 @@ class Split(PrimitiveWithCheck):
|
||||||
tuple[Tensor], the shape of each output tensor is the same, which is
|
tuple[Tensor], the shape of each output tensor is the same, which is
|
||||||
:math:`(y_1, y_2, ..., y_S)`.
|
:math:`(y_1, y_2, ..., y_S)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `axis` or `output_num` is not an int.
|
||||||
|
ValueError: If `axis` is out of the range [-len(`input_x.shape`), len(`input_x.shape`)),
|
||||||
|
or if the `output_num` is less than or equal to 0.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1033,6 +1072,9 @@ class Rank(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor. 0-D int32 Tensor representing the rank of input, i.e., :math:`R`.
|
Tensor. 0-D int32 Tensor representing the rank of input, i.e., :math:`R`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1108,6 +1150,9 @@ class Size(PrimitiveWithInfer):
|
||||||
int, a scalar representing the elements size of `input_x`, tensor is the number of elements
|
int, a scalar representing the elements size of `input_x`, tensor is the number of elements
|
||||||
in a tensor, :math:`size=x_1*x_2*...x_R`.
|
in a tensor, :math:`size=x_1*x_2*...x_R`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1151,6 +1196,9 @@ class Fill(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same type and shape as input value.
|
Tensor, has the same type and shape as input value.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `shape` is not a tuple.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1200,6 +1248,9 @@ class Ones(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same type and shape as input shape value.
|
Tensor, has the same type and shape as input shape value.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `shape` is neither tuple nor int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1253,6 +1304,10 @@ class Zeros(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same type and shape as input shape value.
|
Tensor, has the same type and shape as input shape value.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `shape` is neither int nor tuple.
|
||||||
|
TypeError: If `shape` is a tuple whose elements are not all int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1304,6 +1359,9 @@ class OnesLike(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and type as `input_x` but filled with ones.
|
Tensor, has the same shape and type as `input_x` but filled with ones.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1340,6 +1398,9 @@ class ZerosLike(PrimitiveWithCheck):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and data type as `input_x` but filled with zeros.
|
Tensor, has the same shape and data type as `input_x` but filled with zeros.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1374,6 +1435,10 @@ class TupleToArray(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, if the input tuple contains `N` numbers, then the shape of the output tensor is (N,).
|
Tensor, if the input tuple contains `N` numbers, then the shape of the output tensor is (N,).
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a tuple.
|
||||||
|
ValueError: If length of `input_x` is less than or equal to 0.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1420,6 +1485,9 @@ class ScalarToArray(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor. 0-D Tensor and the content is the input.
|
Tensor. 0-D Tensor and the content is the input.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is neither int nor float.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1456,6 +1524,9 @@ class ScalarToTensor(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor. 0-D Tensor and the content is the input.
|
Tensor. 0-D Tensor and the content is the input.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is neither int nor float.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1502,6 +1573,10 @@ class InvertPermutation(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
tuple[int]. It has the same length as the input.
|
tuple[int]. It has the same length as the input.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is neither tuple nor list.
|
||||||
|
TypeError: If element of `input_x` is not an int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1570,6 +1645,10 @@ class Argmax(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, indices of the max value of input tensor across the axis.
|
Tensor, indices of the max value of input tensor across the axis.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `axis` is not an int.
|
||||||
|
TypeError: If `output_type` is neither int32 nor int64.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1622,6 +1701,10 @@ class Argmin(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, indices of the min value of input tensor across the axis.
|
Tensor, indices of the min value of input tensor across the axis.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `axis` is not an int.
|
||||||
|
TypeError: If `output_type` is neither int32 nor int64.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -1683,6 +1766,10 @@ class ArgMaxWithValue(PrimitiveWithInfer):
|
||||||
:math:`(x_1, x_2, ..., x_{axis-1}, x_{axis+1}, ..., x_N)`.
|
:math:`(x_1, x_2, ..., x_{axis-1}, x_{axis+1}, ..., x_N)`.
|
||||||
- output_x (Tensor) - The maximum value of input tensor, with the same shape as index.
|
- output_x (Tensor) - The maximum value of input tensor, with the same shape as index.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `keep_dims` is not a bool.
|
||||||
|
TypeError: If `axis` is not an int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -1740,6 +1827,10 @@ class ArgMinWithValue(PrimitiveWithInfer):
|
||||||
:math:`(x_1, x_2, ..., x_{axis-1}, x_{axis+1}, ..., x_N)`.
|
:math:`(x_1, x_2, ..., x_{axis-1}, x_{axis+1}, ..., x_N)`.
|
||||||
- output_x (Tensor) - The minimum value of input tensor, with the same shape as index.
|
- output_x (Tensor) - The minimum value of input tensor, with the same shape as index.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `keep_dims` is not a bool.
|
||||||
|
TypeError: If `axis` is not an int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``CPU``
|
``Ascend`` ``CPU``
|
||||||
|
|
||||||
|
@ -1798,6 +1889,10 @@ class Tile(PrimitiveWithInfer):
|
||||||
then the shape of their corresponding positions can be multiplied, and
|
then the shape of their corresponding positions can be multiplied, and
|
||||||
the shape of Outputs is :math:`(1*y_1, ..., x_S*y_R)`.
|
the shape of Outputs is :math:`(1*y_1, ..., x_S*y_R)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `multiples` is not a tuple or its elements are not all int.
|
||||||
|
ValueError: If the elements of `multiples` are not all greater than 0.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1876,6 +1971,10 @@ class UnsortedSegmentSum(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is :math:`(z, x_{N+1}, ..., x_R)`.
|
Tensor, the shape is :math:`(z, x_{N+1}, ..., x_R)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `num_segments` is not an int.
|
||||||
|
ValueError: If length of shape of `segment_ids` is less than 1.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -1966,6 +2065,10 @@ class UnsortedSegmentMin(PrimitiveWithCheck):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, set the number of `num_segments` as `N`, the shape is :math:`(N, x_2, ..., x_R)`.
|
Tensor, set the number of `num_segments` as `N`, the shape is :math:`(N, x_2, ..., x_R)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `num_segments` is not an int.
|
||||||
|
ValueError: If length of shape of `segment_ids` is not equal to 1.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -2021,6 +2124,10 @@ class UnsortedSegmentMax(PrimitiveWithCheck):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, set the number of `num_segments` as `N`, the shape is :math:`(N, x_2, ..., x_R)`.
|
Tensor, set the number of `num_segments` as `N`, the shape is :math:`(N, x_2, ..., x_R)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `num_segments` is not an int.
|
||||||
|
ValueError: If length of shape of `segment_ids` is not equal to 1.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -2074,6 +2181,10 @@ class UnsortedSegmentProd(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, set the number of `num_segments` as `N`, the shape is :math:`(N, x_2, ..., x_R)`.
|
Tensor, set the number of `num_segments` as `N`, the shape is :math:`(N, x_2, ..., x_R)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `num_segments` is not an int.
|
||||||
|
ValueError: If length of shape of `segment_ids` is not equal to 1.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -2140,6 +2251,9 @@ class Concat(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is :math:`(x_1, x_2, ..., \sum_{i=1}^Nx_{mi}, ..., x_R)`.
|
Tensor, the shape is :math:`(x_1, x_2, ..., \sum_{i=1}^Nx_{mi}, ..., x_R)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `axis` is not an int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -2206,6 +2320,9 @@ class ParallelConcat(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, data type is the same as `values`.
|
Tensor, data type is the same as `values`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: If length of shape of `values` is less than 1.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -2469,6 +2586,9 @@ class Slice(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is : input `size`, the data type is the same as input `x`.
|
Tensor, the shape is : input `size`, the data type is the same as input `x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `begin` or `size` is neither tuple nor list.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -2526,6 +2646,10 @@ class ReverseV2(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and type as `input_x`.
|
Tensor, has the same shape and type as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `axis` is neither list nor tuple.
|
||||||
|
TypeError: If element of `axis` is not an int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -2568,6 +2692,9 @@ class Rint(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and type as `input_x`.
|
Tensor, has the same shape and type as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is neither float16 nor float32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -2631,6 +2758,10 @@ class Select(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as `input_x`. The shape is :math:`(x_1, x_2, ..., x_N, ..., x_R)`.
|
Tensor, has the same shape as `input_x`. The shape is :math:`(x_1, x_2, ..., x_N, ..., x_R)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` or `input_y` is not a Tensor.
|
||||||
|
ValueError: If shape of `input_x` is not equal to shape of `input_y` or shape of `input_cond`.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -2768,6 +2899,11 @@ class StridedSlice(PrimitiveWithInfer):
|
||||||
i.e., [3, 3, 3].
|
i.e., [3, 3, 3].
|
||||||
- Finally, the output is [3, 3, 3].
|
- Finally, the output is [3, 3, 3].
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `begin_mask`, `end_mask`, `ellipsis_mask`, `new_axis_mask` or `shrink_axis_mask` is not an int.
|
||||||
|
TypeError: If `begin`, `end` or `strides` is not a tuple.
|
||||||
|
ValueError: If `begin_mask`, `end_mask`, `ellipsis_mask`, `new_axis_mask` or `shrink_axis_mask` is less than 0.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3041,6 +3177,10 @@ class Eye(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, a tensor with ones on the diagonal and the rest of elements are zero.
|
Tensor, a tensor with ones on the diagonal and the rest of elements are zero.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `m` or `n` is not an int.
|
||||||
|
ValueError: If `m` or `n` is less than 1.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3090,6 +3230,10 @@ class ScatterNd(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the new tensor, has the same type as `update` and the same shape as `shape`.
|
Tensor, the new tensor, has the same type as `update` and the same shape as `shape`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `shape` is not a tuple.
|
||||||
|
ValueError: If any element of `shape` is less than 1.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -3146,6 +3290,11 @@ class ResizeNearestNeighbor(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape of the output tensor is :math:`(N, C, NEW\_H, NEW\_W)`.
|
Tensor, the shape of the output tensor is :math:`(N, C, NEW\_H, NEW\_W)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `size` is neither tuple nor list.
|
||||||
|
TypeError: If `align_corners` is not a bool.
|
||||||
|
ValueError: If length of `size` is not equal to 2.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -3190,6 +3339,9 @@ class GatherNd(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same type as `input_x` and the shape is indices_shape[:-1] + x_shape[indices_shape[-1]:].
|
Tensor, has the same type as `input_x` and the shape is indices_shape[:-1] + x_shape[indices_shape[-1]:].
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: If length of shape of `input_x` is less than the last dimension of `indices`.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3223,13 +3375,17 @@ class TensorScatterUpdate(PrimitiveWithInfer):
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
- **input_x** (Tensor) - The target tensor. The dimension of input_x must be equal to indices.shape[-1].
|
- **input_x** (Tensor) - The target tensor. The dimension of input_x must be equal to indices.shape[-1].
|
||||||
- **indices** (Tensor) - The index of input tensor whose data type is int32.
|
- **indices** (Tensor) - The index of input tensor whose data type is int32 or int64.
|
||||||
- **update** (Tensor) - The tensor to update the input tensor, has the same type as input,
|
- **update** (Tensor) - The tensor to update the input tensor, has the same type as input,
|
||||||
and update.shape = indices.shape[:-1] + input_x.shape[indices.shape[-1]:].
|
and update.shape = indices.shape[:-1] + input_x.shape[indices.shape[-1]:].
|
||||||
|
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and type as `input_x`.
|
Tensor, has the same shape and type as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `indices` is neither int32 nor int64.
|
||||||
|
ValueError: If length of shape of `input_x` is less than the last dimension of shape of `indices`.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3293,6 +3449,9 @@ class ScatterUpdate(_ScatterOp_Dynamic):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and type as `input_x`.
|
Tensor, has the same shape and type as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `use_locking` is not a bool.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -3351,6 +3510,9 @@ class ScatterNdUpdate(_ScatterNdOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and type as `input_x`.
|
Tensor, has the same shape and type as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `use_locking` is not a bool.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``CPU``
|
``Ascend`` ``CPU``
|
||||||
|
|
||||||
|
@ -3411,6 +3573,9 @@ class ScatterMax(_ScatterOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Parameter, the updated `input_x`.
|
Parameter, the updated `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `use_locking` is not a bool.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3457,6 +3622,9 @@ class ScatterMin(_ScatterOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Parameter, the updated `input_x`.
|
Parameter, the updated `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `use_locking` is not a bool.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3502,6 +3670,9 @@ class ScatterAdd(_ScatterOp_Dynamic):
|
||||||
Outputs:
|
Outputs:
|
||||||
Parameter, the updated `input_x`.
|
Parameter, the updated `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `use_locking` is not a bool.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -3555,6 +3726,9 @@ class ScatterSub(_ScatterOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Parameter, the updated `input_x`.
|
Parameter, the updated `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `use_locking` is not a bool.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3600,6 +3774,9 @@ class ScatterMul(_ScatterOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Parameter, the updated `input_x`.
|
Parameter, the updated `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `use_locking` is not a bool.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3645,6 +3822,9 @@ class ScatterDiv(_ScatterOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Parameter, the updated `input_x`.
|
Parameter, the updated `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `use_locking` is not a bool.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3694,6 +3874,9 @@ class ScatterNdAdd(_ScatterNdOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Parameter, the updated `input_x`.
|
Parameter, the updated `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `use_locking` is not a bool.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3742,6 +3925,9 @@ class ScatterNdSub(_ScatterNdOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Parameter, the updated `input_x`.
|
Parameter, the updated `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `use_locking` is not a bool.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3777,6 +3963,10 @@ class ScatterNonAliasingAdd(_ScatterNdOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Parameter, the updated `input_x`.
|
Parameter, the updated `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `indices` is not int32.
|
||||||
|
TypeError: If dtype of `input_x` is not one of float16, float32, int32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3825,6 +4015,11 @@ class SpaceToDepth(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the same data type as `x`. It must be a 4-D tensor.
|
Tensor, the same data type as `x`. It must be a 4-D tensor.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `block_size` is not an int.
|
||||||
|
ValueError: If `block_size` is less than 2.
|
||||||
|
ValueError: If length of shape of `x` is not equal to 4.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3887,6 +4082,11 @@ class DepthToSpace(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor of shape :math:`(N, C_{in} / \text{block_size}, H_{in} * \text{block_size}, W_{in} * \text{block_size})`.
|
Tensor of shape :math:`(N, C_{in} / \text{block_size}, H_{in} * \text{block_size}, W_{in} * \text{block_size})`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `block_size` is not an int.
|
||||||
|
ValueError: If `block_size` is less than 2.
|
||||||
|
ValueError: If length of shape of `x` is not equal to 4.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3934,7 +4134,7 @@ class SpaceToBatch(PrimitiveWithInfer):
|
||||||
of the input are zero padded according to paddings if necessary.
|
of the input are zero padded according to paddings if necessary.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
block_size (int): The block size of dividing blocks with value greater than 2.
|
block_size (int): The block size of dividing blocks with value greater than or euqual to 2.
|
||||||
paddings (Union[tuple, list]): The padding values for H and W dimension, containing 2 subtraction lists.
|
paddings (Union[tuple, list]): The padding values for H and W dimension, containing 2 subtraction lists.
|
||||||
Each subtraction list contains 2 integer value. All values must be greater than 0.
|
Each subtraction list contains 2 integer value. All values must be greater than 0.
|
||||||
paddings[i] specifies the paddings for the spatial dimension i, which corresponds to the
|
paddings[i] specifies the paddings for the spatial dimension i, which corresponds to the
|
||||||
|
@ -3957,6 +4157,10 @@ class SpaceToBatch(PrimitiveWithInfer):
|
||||||
|
|
||||||
:math:`w' = (w+paddings[1][0]+paddings[1][1])//block\_size`
|
:math:`w' = (w+paddings[1][0]+paddings[1][1])//block\_size`
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `block_size` is not an int.
|
||||||
|
ValueError: If `block_size` is less than 2.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -4036,6 +4240,11 @@ class BatchToSpace(PrimitiveWithInfer):
|
||||||
|
|
||||||
:math:`w' = w*block\_size-crops[1][0]-crops[1][1]`
|
:math:`w' = w*block\_size-crops[1][0]-crops[1][1]`
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `block_size` or element of `crops` is not an int.
|
||||||
|
TypeError: If `crops` is neither list nor tuple.
|
||||||
|
ValueError: If `block_size` is less than 2.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -4121,6 +4330,12 @@ class SpaceToBatchND(PrimitiveWithInfer):
|
||||||
|
|
||||||
:math:`w' = (w+paddings[1][0]+paddings[1][1])//block\_shape[1]`
|
:math:`w' = (w+paddings[1][0]+paddings[1][1])//block\_shape[1]`
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `block_shape` is not one of list, tuple, int.
|
||||||
|
TypeError: If `paddings` is neither list nor tuple.
|
||||||
|
ValueError: If length of shape of `block_shape` is not equal to 1.
|
||||||
|
ValueError: If length of `block_shape` or `paddings` is not equal to 2.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -4217,6 +4432,11 @@ class BatchToSpaceND(PrimitiveWithInfer):
|
||||||
|
|
||||||
:math:`w' = w*block\_shape[1]-crops[1][0]-crops[1][1]`
|
:math:`w' = w*block\_shape[1]-crops[1][0]-crops[1][1]`
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `block_shape` is not one of list, tuple, int.
|
||||||
|
TypeError: If `crops` is neither list nor tuple.
|
||||||
|
ValueError: If length of `block_shape` or `crops` is not equal to 2.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -4302,6 +4522,7 @@ class BroadcastTo(PrimitiveWithInfer):
|
||||||
Tensor, with the given `shape` and the same data type as `input_x`.
|
Tensor, with the given `shape` and the same data type as `input_x`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
|
TypeError: If `shape` is not a tuple.
|
||||||
ValueError: Given a shape tuple, if it has several -1; or if the -1 is in an invalid position
|
ValueError: Given a shape tuple, if it has several -1; or if the -1 is in an invalid position
|
||||||
such as one that does not have a opposing dimension in an input tensor; or if the target and
|
such as one that does not have a opposing dimension in an input tensor; or if the target and
|
||||||
input shapes are incompatible.
|
input shapes are incompatible.
|
||||||
|
@ -4391,6 +4612,10 @@ class Meshgrid(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensors, A Tuple of N N-D Tensor objects.
|
Tensors, A Tuple of N N-D Tensor objects.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `indexing` is not a str or `input` is not a tuple.
|
||||||
|
ValueError: If `indexing` is neither 'xy' nor 'ij'.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -4489,6 +4714,10 @@ class InplaceUpdate(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, with the same type and shape as the input `x`.
|
Tensor, with the same type and shape as the input `x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `indices` is neither int nor tuple.
|
||||||
|
TypeError: If `indices` is a tuple and its element is not an int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -4549,6 +4778,9 @@ class ReverseSequence(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Reversed tensor with the same shape and data type as input.
|
Reversed tensor with the same shape and data type as input.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `seq_dim` or `batch_dim` is not an int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -4612,6 +4844,9 @@ class EditDistance(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, a dense tensor with rank `R-1` and float32 data type.
|
Tensor, a dense tensor with rank `R-1` and float32 data type.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `normalize` is not a bool.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -4729,6 +4964,11 @@ class Sort(PrimitiveWithInfer):
|
||||||
- **y1** (Tensor) - A tensor whose values are the sorted values, with the same shape and data type as input.
|
- **y1** (Tensor) - A tensor whose values are the sorted values, with the same shape and data type as input.
|
||||||
- **y2** (Tensor) - The indices of the elements in the original input tensor. Data type is int32.
|
- **y2** (Tensor) - The indices of the elements in the original input tensor. Data type is int32.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `axis` is not an int.
|
||||||
|
TypeError: If `descending` is not a bool.
|
||||||
|
TypeError: If dtype of `x` is neither float16 nor float32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -4780,6 +5020,10 @@ class EmbeddingLookup(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape of tensor is :math:`(z_1, z_2, ..., z_N)`.
|
Tensor, the shape of tensor is :math:`(z_1, z_2, ..., z_N)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_indices` is not int.
|
||||||
|
ValueError: If length of shape of `input_params` is greater than 2.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``CPU``
|
``Ascend`` ``CPU``
|
||||||
|
|
||||||
|
@ -4843,13 +5087,17 @@ class GatherD(PrimitiveWithInfer):
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
- **x** (Tensor) - The source tensor.
|
- **x** (Tensor) - The source tensor.
|
||||||
- **dim** (int) - The axis along which to index. It must be int32. Only constant value is allowed.
|
- **dim** (int) - The axis along which to index. It must be int32 or int64. Only constant value is allowed.
|
||||||
- **index** (Tensor) - The indices of elements to gather. It can be one of the following data types:
|
- **index** (Tensor) - The indices of elements to gather. It can be one of the following data types:
|
||||||
int32, int64. The value range of each index element is [-x_rank[dim], x_rank[dim]).
|
int32, int64. The value range of each index element is [-x_rank[dim], x_rank[dim]).
|
||||||
|
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape of tensor is :math:`(z_1, z_2, ..., z_N)`.
|
Tensor, the shape of tensor is :math:`(z_1, z_2, ..., z_N)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `dim` or `index` is neither int32 nor int64.
|
||||||
|
ValueError: If length of shape of `x` is not equal to length of shape of `index`.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -4903,6 +5151,9 @@ class Identity(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape of tensor is the same as `input_x`, :math:`(x_1, x_2, ..., x_R)`.
|
Tensor, the shape of tensor is the same as `input_x`, :math:`(x_1, x_2, ..., x_R)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2020 Huawei Technologies Co., Ltd
|
# Copyright 2020-2021 Huawei Technologies Co., Ltd
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -53,6 +53,11 @@ class CropAndResize(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth] with type: float32.
|
A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth] with type: float32.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `method` is not a str.
|
||||||
|
TypeError: If `extrapolation_value` is not a float.
|
||||||
|
ValueError: If `method` is not one of 'bilinear', 'nearest', 'bilinear_v2'.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
|
|
@ -200,6 +200,9 @@ class AssignAdd(PrimitiveWithInfer):
|
||||||
- **value** (Union[numbers.Number, Tensor]) - The value to be added to the `variable`.
|
- **value** (Union[numbers.Number, Tensor]) - The value to be added to the `variable`.
|
||||||
It must have the same shape as `variable` if it is a Tensor.
|
It must have the same shape as `variable` if it is a Tensor.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `value` is neither Number nor Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -256,6 +259,9 @@ class AssignSub(PrimitiveWithInfer):
|
||||||
- **value** (Union[numbers.Number, Tensor]) - The value to be subtracted from the `variable`.
|
- **value** (Union[numbers.Number, Tensor]) - The value to be subtracted from the `variable`.
|
||||||
It must have the same shape as `variable` if it is a Tensor.
|
It must have the same shape as `variable` if it is a Tensor.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `value` is neither Number nor Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -673,6 +679,10 @@ class CumProd(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and dtype as the `input_x`.
|
Tensor, has the same shape and dtype as the `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `exclusive` or `reverse` is not a bool.
|
||||||
|
ValueError: If `axis` is None.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -815,6 +825,10 @@ class BatchMatMul(MatMul):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape of the output tensor is :math:`(*B, N, M)`.
|
Tensor, the shape of the output tensor is :math:`(*B, N, M)`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `transpose_a` or `transpose_b` is not a bool.
|
||||||
|
ValueError: If length of shape of `input_x` is less than 3 or not equal to length of shape of `input_y`.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -881,6 +895,10 @@ class CumSum(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape of the output tensor is consistent with the input tensor's.
|
Tensor, the shape of the output tensor is consistent with the input tensor's.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `exclusive` or `reverse` is not a bool.
|
||||||
|
TypeError: If `axis` is not an int.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -929,6 +947,9 @@ class AddN(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and dtype as each entry of the `input_x`.
|
Tensor, has the same shape and dtype as each entry of the `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is neither tuple nor list.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1015,6 +1036,9 @@ class AccumulateNV2(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and dtype as each entry of the `input_x`.
|
Tensor, has the same shape and dtype as each entry of the `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is neither tuple nor list.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -1125,6 +1149,11 @@ class InplaceAdd(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and dtype as input_x.
|
Tensor, has the same shape and dtype as input_x.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `indices` is neither int nor tuple.
|
||||||
|
TypeError: If `indices` is a tuple whose elements are not all int.
|
||||||
|
ValueError: If length of shape of `input_x` is not equal to length of shape of `input_v`.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -1187,6 +1216,11 @@ class InplaceSub(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and dtype as input_x.
|
Tensor, has the same shape and dtype as input_x.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `indices` is neither int nor tuple.
|
||||||
|
TypeError: If `indices` is a tuple whose elements are not all int.
|
||||||
|
ValueError: If length of shape of `input_x` is not equal to length of shape of `input_v`.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -1591,6 +1625,9 @@ class Exp(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and dtype as the `input_x`.
|
Tensor, has the same shape and dtype as the `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is neither float16 nor float32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1611,7 +1648,7 @@ class Exp(PrimitiveWithInfer):
|
||||||
return x_shape
|
return x_shape
|
||||||
|
|
||||||
def infer_dtype(self, x_type):
|
def infer_dtype(self, x_type):
|
||||||
validator.check_subclass("x", x_type, mstype.tensor, self.name)
|
validator.check_tensor_dtype_valid("x", x_type, [mstype.float16, mstype.float32], self.name)
|
||||||
return x_type
|
return x_type
|
||||||
|
|
||||||
def infer_value(self, x):
|
def infer_value(self, x):
|
||||||
|
@ -1637,6 +1674,9 @@ class Expm1(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as the `input_x`.
|
Tensor, has the same shape as the `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is neither float16 nor float32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1678,6 +1718,11 @@ class HistogramFixedWidth(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the type is int32.
|
Tensor, the type is int32.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `dtype` is not a str or `nbins` is not an int.
|
||||||
|
ValueError: If `nbins` is less than 1.
|
||||||
|
ValueError: If `dtype` is neither 'int32' nor 'int64'.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -1719,6 +1764,9 @@ class Log(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as the `input_x`.
|
Tensor, has the same shape as the `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is neither float16 nor float32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -1739,6 +1787,7 @@ class Log(PrimitiveWithInfer):
|
||||||
|
|
||||||
def infer_dtype(self, x):
|
def infer_dtype(self, x):
|
||||||
validator.check_subclass("x", x, mstype.tensor, self.name)
|
validator.check_subclass("x", x, mstype.tensor, self.name)
|
||||||
|
validator.check_tensor_dtype_valid("x", x, [mstype.float16, mstype.float32], self.name)
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def infer_value(self, x):
|
def infer_value(self, x):
|
||||||
|
@ -1760,6 +1809,9 @@ class Log1p(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as the `input_x`.
|
Tensor, has the same shape as the `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is neither float16 nor float32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -1798,6 +1850,9 @@ class Erf(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and dtype as the `input_x`.
|
Tensor, has the same shape and dtype as the `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is neither float16 nor float32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -1836,6 +1891,9 @@ class Erfc(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and dtype as the `input_x`.
|
Tensor, has the same shape and dtype as the `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is neither float16 nor float32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -2015,6 +2073,9 @@ class Div(_MathBinaryOp):
|
||||||
Tensor, the shape is the same as the one after broadcasting,
|
Tensor, the shape is the same as the one after broadcasting,
|
||||||
and the data type is the one with higher precision or higher digits among the two inputs.
|
and the data type is the one with higher precision or higher digits among the two inputs.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If neither `input_x` nor `input_y` is a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -2057,6 +2118,9 @@ class DivNoNan(_MathBinaryOp):
|
||||||
Tensor, the shape is the same as the one after broadcasting,
|
Tensor, the shape is the same as the one after broadcasting,
|
||||||
and the data type is the one with higher precision or higher digits among the two inputs.
|
and the data type is the one with higher precision or higher digits among the two inputs.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If neither `input_x` nor `input_y` is a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -2158,6 +2222,9 @@ class FloorDiv(_MathBinaryOp):
|
||||||
Tensor, the shape is the same as the one after broadcasting,
|
Tensor, the shape is the same as the one after broadcasting,
|
||||||
and the data type is the one with higher precision or higher digits among the two inputs.
|
and the data type is the one with higher precision or higher digits among the two inputs.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If neither `input_x` nor `input_y` is a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -2296,6 +2363,9 @@ class Floor(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as `input_x`.
|
Tensor, has the same shape as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is not float.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -2340,6 +2410,9 @@ class FloorMod(_MathBinaryOp):
|
||||||
Tensor, the shape is the same as the one after broadcasting,
|
Tensor, the shape is the same as the one after broadcasting,
|
||||||
and the data type is the one with higher precision or higher digits among the two inputs.
|
and the data type is the one with higher precision or higher digits among the two inputs.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If neither `input_x` nor `input_y` is a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -2367,6 +2440,9 @@ class Ceil(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as `input_x`.
|
Tensor, has the same shape as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is neither float16 nor float32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -2481,6 +2557,9 @@ class Acosh(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and type as `input_x`.
|
Tensor, has the same shape and type as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -2514,6 +2593,9 @@ class Cosh(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as `input_x`.
|
Tensor, has the same shape as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -2552,6 +2634,9 @@ class Asinh(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and type as `input_x`.
|
Tensor, has the same shape and type as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU``
|
``Ascend`` ``GPU``
|
||||||
|
|
||||||
|
@ -2642,6 +2727,9 @@ class Equal(_LogicBinaryOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is the same as the one after broadcasting,and the data type is bool.
|
Tensor, the shape is the same as the one after broadcasting,and the data type is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If neither `input_x` nor `input_y` is a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -2692,6 +2780,9 @@ class ApproximateEqual(_LogicBinaryOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is the same as the shape of 'x1', and the data type is bool.
|
Tensor, the shape is the same as the shape of 'x1', and the data type is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `tolerance` is not a float.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -2733,6 +2824,10 @@ class EqualCount(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, with the type same as input tensor and size as (1,).
|
Tensor, with the type same as input tensor and size as (1,).
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` or `input_y` is not a Tensor.
|
||||||
|
ValueError: If shape of `input_x` is not equal to shape of `input_y`.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``GPU`` ``CPU``
|
``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -2819,7 +2914,10 @@ class Greater(_LogicBinaryOp):
|
||||||
a bool when the first input is a tensor or a tensor whose data type is number or bool.
|
a bool when the first input is a tensor or a tensor whose data type is number or bool.
|
||||||
|
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is the same as the one after broadcasting,and the data type is bool.
|
Tensor, the shape is the same as the one after broadcasting, and the data type is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If neither `input_x` nor `input_y` is a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
@ -2860,7 +2958,10 @@ class GreaterEqual(_LogicBinaryOp):
|
||||||
a bool when the first input is a tensor or a tensor whose data type is number or bool.
|
a bool when the first input is a tensor or a tensor whose data type is number or bool.
|
||||||
|
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is the same as the one after broadcasting,and the data type is bool.
|
Tensor, the shape is the same as the one after broadcasting, and the data type is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If neither `input_x` nor `input_y` is a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
@ -2903,6 +3004,9 @@ class Less(_LogicBinaryOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is the same as the one after broadcasting,and the data type is bool.
|
Tensor, the shape is the same as the one after broadcasting,and the data type is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If neither `input_x` nor `input_y` is a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -2944,6 +3048,9 @@ class LessEqual(_LogicBinaryOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is the same as the one after broadcasting,and the data type is bool.
|
Tensor, the shape is the same as the one after broadcasting,and the data type is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If neither `input_x` nor `input_y` is a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -2975,6 +3082,9 @@ class LogicalNot(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is the same as the `input_x`, and the dtype is bool.
|
Tensor, the shape is the same as the `input_x`, and the dtype is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3018,6 +3128,9 @@ class LogicalAnd(_LogicBinaryOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is the same as the one after broadcasting, and the data type is bool.
|
Tensor, the shape is the same as the one after broadcasting, and the data type is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If neither `input_x` nor `input_y` is a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3053,6 +3166,9 @@ class LogicalOr(_LogicBinaryOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is the same as the one after broadcasting,and the data type is bool.
|
Tensor, the shape is the same as the one after broadcasting,and the data type is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If neither `input_x` nor `input_y` is a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3079,6 +3195,9 @@ class IsNan(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape of input, and the dtype is bool.
|
Tensor, has the same shape of input, and the dtype is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``GPU``
|
``GPU``
|
||||||
|
|
||||||
|
@ -3112,6 +3231,9 @@ class IsInf(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape of input, and the dtype is bool.
|
Tensor, has the same shape of input, and the dtype is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``GPU``
|
``GPU``
|
||||||
|
|
||||||
|
@ -3145,6 +3267,9 @@ class IsFinite(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape of input, and the dtype is bool.
|
Tensor, has the same shape of input, and the dtype is bool.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3179,6 +3304,9 @@ class FloatStatus(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the shape of `(1,)`, and the dtype is `mindspore.dtype.float32`.
|
Tensor, has the shape of `(1,)`, and the dtype is `mindspore.dtype.float32`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is neither float16 nor float32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``GPU``
|
``GPU``
|
||||||
|
|
||||||
|
@ -3341,6 +3469,9 @@ class Cos(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as `input_x`.
|
Tensor, has the same shape as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3378,6 +3509,9 @@ class ACos(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as `input_x`.
|
Tensor, has the same shape as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3448,6 +3582,9 @@ class Asin(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as `input_x`.
|
Tensor, has the same shape as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3550,6 +3687,9 @@ class Abs(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as the `input_x`.
|
Tensor, has the same shape as the `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3665,6 +3805,9 @@ class Tan(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as `input_x`.
|
Tensor, has the same shape as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is not one of float16, float32, int32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``CPU``
|
``Ascend`` ``CPU``
|
||||||
|
|
||||||
|
@ -3703,6 +3846,9 @@ class Atan(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
A Tensor, has the same type as the input.
|
A Tensor, has the same type as the input.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend`` ``GPU`` ``CPU``
|
``Ascend`` ``GPU`` ``CPU``
|
||||||
|
|
||||||
|
@ -3736,6 +3882,9 @@ class Atanh(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
A Tensor, has the same type as the input.
|
A Tensor, has the same type as the input.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3778,6 +3927,9 @@ class Atan2(_MathBinaryOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, the shape is the same as the one after broadcasting,and the data type is same as `input_x`.
|
Tensor, the shape is the same as the one after broadcasting,and the data type is same as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` or `input_y` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3851,6 +4003,9 @@ class BitwiseAnd(_BitwiseBinaryOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same type as the `input_x1`.
|
Tensor, has the same type as the `input_x1`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x1` or `input_x2` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3881,6 +4036,9 @@ class BitwiseOr(_BitwiseBinaryOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same type as the `input_x1`.
|
Tensor, has the same type as the `input_x1`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x1` or `input_x2` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3911,6 +4069,9 @@ class BitwiseXor(_BitwiseBinaryOp):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same type as the `input_x1`.
|
Tensor, has the same type as the `input_x1`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x1` or `input_x2` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3935,6 +4096,9 @@ class BesselI0e(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as `input_x`.
|
Tensor, has the same shape as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -3969,6 +4133,9 @@ class BesselI1e(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as `input_x`.
|
Tensor, has the same shape as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If `input_x` is not a Tensor.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -4003,6 +4170,9 @@ class Inv(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape and data type as `input_x`.
|
Tensor, has the same shape and data type as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is not one of float16, float32, int32.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
@ -4037,6 +4207,9 @@ class Invert(PrimitiveWithInfer):
|
||||||
Outputs:
|
Outputs:
|
||||||
Tensor, has the same shape as `input_x`.
|
Tensor, has the same shape as `input_x`.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
TypeError: If dtype of `input_x` is neither int16 nor uint16.
|
||||||
|
|
||||||
Supported Platforms:
|
Supported Platforms:
|
||||||
``Ascend``
|
``Ascend``
|
||||||
|
|
||||||
|
|
|
@ -111,10 +111,10 @@ def test_pow():
|
||||||
|
|
||||||
def test_exp():
|
def test_exp():
|
||||||
""" test_exp """
|
""" test_exp """
|
||||||
input_tensor = Tensor(np.array([[2, 2], [3, 3]]))
|
input_tensor = Tensor(np.array([[2, 2], [3, 3]], np.float32))
|
||||||
testexp = P.Exp()
|
testexp = P.Exp()
|
||||||
result = testexp(input_tensor)
|
result = testexp(input_tensor)
|
||||||
expect = np.exp(np.array([[2, 2], [3, 3]]))
|
expect = np.exp(np.array([[2, 2], [3, 3]], np.float32))
|
||||||
assert np.all(result.asnumpy() == expect)
|
assert np.all(result.asnumpy() == expect)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue