mindspore.ops
For more information about dynamic shape support status, please refer to Dynamic Shape Support Status of ops Interface .
Compared with the previous version, the added, deleted and supported platforms change information of mindspore.ops operators in MindSpore, please refer to the link mindspore.ops API Interface Change.
Neural Network Layer Functions
Neural Network
API Name |
Description |
Supported Platforms |
Warning |
Applies a 1D adaptive average pooling over an input Tensor which can be regarded as a composition of 1D input planes. |
|
None |
|
Performs 2D adaptive average pooling on a multi-plane input signal. |
|
This is an experimental API that is subject to change or deletion. |
|
Performs 3D adaptive average pooling on a multi-plane input signal. |
|
None |
|
Applies a 1D adaptive maximum pooling over an input Tensor which can be regarded as a composition of 1D input planes. |
|
None |
|
This operator applies a 2D adaptive max pooling to an input signal composed of multiple input planes. |
|
None |
|
Applies a 1D average pooling over an input Tensor which can be regarded as a composition of 1D input planes. |
|
kernel_size is in the range [1, 255]. stride is in the range [1, 63]. |
|
Applies a 2D average pooling over an input Tensor which can be regarded as a composition of 2D input planes. |
|
kernel_size is in the range [1, 255]. stride is in the range [1, 63]. |
|
Applies a 3D average pooling over an input Tensor which can be regarded as a composition of 3D input planes. |
|
kernel_size is in the range [1, 255]. stride is in the range [1, 63]. |
|
Batch Normalization for input data and updated parameters. |
|
For Atlas 200/300/500 inference product, the result accuracy fails to reach 1‰ due to the square root instruction. |
|
Returns the sum of the input_x and the bias Tensor. |
|
None |
|
Applies bilinear dense connected layer for input1 and input2. |
|
This is an experimental API that is subject to change or deletion. |
|
Performs greedy decoding on the logits given in inputs. |
|
None |
|
Applies a 1D convolution over an input tensor. |
|
None |
|
Applies a 2D convolution over an input tensor. |
|
None |
|
Applies a 3D convolution over an input tensor. |
|
None |
|
Given 4D tensor inputs x, weight and offsets, compute a 2D deformable convolution. |
|
This is an experimental API that is subject to change or deletion. |
|
Applies the dense connected operation to the input. |
|
This is an experimental API that is subject to change or deletion. In PYNATIVE mode, if bias is not 1D, the input cannot be greater than 6D. |
|
During training, randomly zeroes some of the elements of the input tensor with probability p from a Bernoulli distribution. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
During training, randomly zeroes some channels of the input tensor with probability p from a Bernoulli distribution(For a 3-dimensional tensor with a shape of \(NCL\), the channel feature map refers to a 1-dimensional feature map with the shape of \(L\)). |
|
None |
|
During training, randomly zeroes some channels of the input tensor with probability p from a Bernoulli distribution(For a 4-dimensional tensor with a shape of \(NCHW\), the channel feature map refers to a 2-dimensional feature map with the shape of \(HW\)). |
|
None |
|
During training, randomly zeroes some channels of the input tensor with probability p from a Bernoulli distribution(For a 5-dimensional tensor with a shape of \(NCDHW\), the channel feature map refers to a 3-dimensional feature map with a shape of \(DHW\)). |
|
None |
|
Retrieve the word embeddings in weight using indices specified in input. |
|
On Ascend, the behavior is unpredictable when the value of input is invalid. |
|
Flatten a tensor along dimensions from start_dim to start_dim. |
|
None |
|
Combines an array of sliding local blocks into a large containing tensor. |
|
The input must be a 3-dimensional Tensor with shape \((N, C \times \prod(\text{kernel_size}), L)\) . The output must be a 4-dimensional Tensor with shape \((N, C, output\_size[0], output\_size[1], ...)\) . |
|
Applies the 3D FractionalMaxPool operation over input. |
|
This is an experimental API that is subject to change or deletion. |
|
Group Normalization over a mini-batch of inputs. |
|
None |
|
Applies the Layer Normalization on the mini-batch input. |
|
None |
|
Applying 1D LPPooling operation on an input Tensor can be regarded as forming a 1D input plane. |
|
None |
|
Applying 2D LPPooling operation on an input Tensor can be regarded as forming a 2D input plane. |
|
None |
|
Local Response Normalization. |
|
lrn is deprecated on Ascend due to potential accuracy problem. It's recommended to use other normalization methods, e.g. |
|
Performs a 2D max pooling on the input Tensor. |
|
None |
|
Performs a 3D max pooling on the input Tensor. |
|
None |
|
Computes the inverse of max_pool1d. |
|
None |
|
Computes the inverse of max_pool2d. |
|
None |
|
Computes the inverse of |
|
None |
|
The interface for incremental inference. |
|
None |
|
The interface for fully inference. |
|
Support dtype of float16 for attn_mask will be deprecated in the future. When sparse_mode is 2, 3 or 4, the shape of attn_mask must be \((2048, 2048)\) / \((B, 1, 2048, 2048)\) / \((1, 1, 2048, 2048)\). |
|
The RmsNorm(Root Mean Square Layer Normalization) operator is a normalization operation. |
|
This is an experimental API that is subject to change or deletion. This API is only supported in Atlas A2 training series for now. |
|
Extracts sliding local blocks from a batched input tensor. |
|
The output is a 3-dimensional Tensor whose shape is \((N, C \times \prod(\text{kernel_size}), L)\) . This is an experimental API that is subject to change or deletion. |
Loss Functions
API Name |
Description |
Supported Platforms |
Warning |
Computes the binary cross entropy(Measure the difference information between two probability distributions) between predictive value logits and target value labels. |
|
The value of logits must range from 0 to l. |
|
Adds sigmoid activation function to input input as logits, and uses the given logits to compute binary cross entropy between the input and the target. |
|
None |
|
CosineEmbeddingLoss creates a criterion to measure the similarity between two tensors using cosine distance. |
|
None |
|
The cross entropy loss between input and target. |
|
None |
|
Calculates the CTC (Connectionist Temporal Classification) loss and the gradient. |
|
None |
|
Gaussian negative log likelihood loss. |
|
None |
|
Measures Hinge Embedding Loss given an input Tensor intputs and a labels Tensor targets (containing 1 or -1). |
|
None |
|
Calculates the error between the predicted value and the target value, which has the best of both the loss of |
|
None |
|
Computes the Kullback-Leibler divergence between the logits and the labels. |
|
None |
|
Calculate the mean absolute error between the input value and the target value. |
|
None |
|
MarginRankingLoss creates a criterion that measures the loss. |
|
None |
|
Calculates the mean squared error between the predicted value and the label value. |
|
None |
|
Hinge loss for optimizing a multi-class classification. |
|
None |
|
Hinge loss for optimizing a multi-label classification. |
|
None |
|
Calculates the MultiLabelSoftMarginLoss. |
|
None |
|
Gets the negative log likelihood loss between inputs and target. |
|
None |
|
Computes smooth L1 loss, a robust L1 loss. |
|
None |
|
Calculate the soft margin loss of input and target. |
|
This is an experimental API that is subject to change or deletion. |
|
TripletMarginLoss operation. |
|
None |
Activation Functions
API Name |
Description |
Supported Platforms |
Warning |
celu activation function, computes celu (Continuously differentiable exponential linear units) of input tensors element-wise. |
|
This is an experimental API that is subject to change or deletion. |
|
Exponential Linear Unit activation function. |
|
None |
|
Fast Gaussian Error Linear Units activation function. |
|
None |
|
Gaussian Error Linear Units activation function. |
|
None |
|
Computes GLU (Gated Linear Unit activation function) of input tensors. |
|
None |
|
Returns the samples from the Gumbel-Softmax distribution and optionally discretizes. |
|
None |
|
Hard Shrink activation function. |
|
None |
|
Hard Sigmoid activation function. |
|
None |
|
Hard Swish activation function. |
|
None |
|
Applies the hardtanh activation function element-wise. |
|
None |
|
leaky_relu activation function. |
|
None |
|
Applies the Log Softmax function to the input tensor on the specified axis. |
|
None |
|
Applies logsigmoid activation element-wise. |
|
None |
|
Computes MISH(A Self Regularized Non-Monotonic Neural Activation Function) of input tensors element-wise. |
|
None |
|
Parametric Rectified Linear Unit activation function. |
|
None |
|
Computes ReLU (Rectified Linear Unit activation function) of input tensors element-wise. |
|
None |
|
Computes ReLU (Rectified Linear Unit) upper bounded by 6 of input tensors element-wise. |
|
None |
|
Randomized Leaky ReLU activation function. |
|
None |
|
Activation function SeLU (Scaled exponential Linear Unit). |
|
None |
|
Computes Sigmoid of input element-wise. |
|
None |
|
Computes Sigmoid Linear Unit of input element-wise. |
|
None |
|
Applies the Softmax operation to the input tensor on the specified axis. |
|
None |
|
Applies the Softmin operation to the input tensor on the specified axis. |
|
None |
|
Soft Shrink activation function. |
|
None |
|
SoftSign activation function. |
|
None |
|
Computes hyperbolic tangent of input element-wise. |
|
None |
|
Returns each element of input after thresholding by thr as a Tensor. |
|
None |
Distance Functions
API Name |
Description |
Supported Platforms |
Warning |
Computes p-norm distance between each pair of row vectors of two input Tensors. |
|
None |
|
Computes batched the \(p\)-norm distance between each pair of the two collections of row vectors. |
|
None |
|
Calculates the distance between every pair of row vectors in the input using the p-norm. |
|
None |
Sampling Functions
API Name |
Description |
Supported Platforms |
Warning |
Generates a random sample as index tensor with a mask tensor from a given tensor. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Generates random samples from a given categorical distribution tensor. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Generates random labels with a log-uniform distribution for sampled_candidates. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Uniform candidate sampler. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. The Ascend backend does not support dynamic shape scenarios currently. |
Image Functions
API Name |
Description |
Supported Platforms |
Warning |
Returns a 2D or 3D flow field (sampling grid) based on theta, a batch of affine matrices. |
|
None |
|
Decode the bounding box locations, calculate the offset, and convert the offset into a Bbox, which is used to mark the target in the subsequent images, etc. |
|
None |
|
Encode the bounding box locations, calculate the offset between the predicted bounding boxes and the real bounding boxes, and the offset will be used as a variable for the loss. |
|
None |
|
Combines an array of sliding local blocks into a large containing tensor. |
|
None |
|
Checks whether the bounding box is in the image. |
|
The bounding box specified by bboxes and the image information specified by img_metas need to be valid, i.e.: \(x0 <= x1\) , \(y0 <= y1\) , and \((height, width, ratio)\) are all positive. |
|
Extracts crops from the input image Tensor and resizes them. |
|
None |
|
Given an input and a flow-field grid, computes the output using input values and pixel locations from grid. |
|
None |
|
Samples the input Tensor to the given size or scale_factor by using one of the interpolate algorithms. |
|
None |
|
Calculates intersection over union for boxes. |
|
In Ascend, only computation of float16 data is supported. To avoid overflow, the input length and width are scaled by 0.2 internally. |
|
Pads the input tensor according to the padding. |
|
None |
|
Extends the last dimension of the input tensor from 1 to pad_dim_size, by filling with 0. |
|
None |
|
Applies the PixelShuffle operation over input input which implements sub-pixel convolutions with stride \(1/r\) . |
|
None |
|
Applies the PixelUnshuffle operation over input input which is the inverse of PixelShuffle. |
|
None |
|
Alias for |
|
None |
Mathematical Functions
Element-wise Operations
API Name |
Description |
Supported Platforms |
Warning |
Returns absolute value of a tensor element-wise. |
|
None |
|
Alias for |
|
None |
|
Computes accumulation of all input tensors element-wise. |
|
None |
|
Computes arccosine of input tensors element-wise. |
|
None |
|
Alias for |
|
None |
|
Computes inverse hyperbolic cosine of the inputs element-wise. |
|
None |
|
Adds other value to input Tensor. |
|
None |
|
Performs the element-wise division of tensor tensor1 by tensor tensor2, multiply the result by the scalar value and add it to input data. |
|
None |
|
Performs the element-wise product of tensor tensor1 and tensor tensor2, multiply the result by the scalar value and add it to input data. |
|
None |
|
Multiplies matrix mat and vector vec. |
|
None |
|
Computes addition of all input tensors element-wise. |
|
None |
|
Returns the element-wise argument of a complex tensor. |
Ascend`` |
None |
|
Alias for |
|
None |
|
Alias for |
|
None |
|
Alias for |
|
None |
|
Alias for |
|
None |
|
Alias for |
|
None |
|
Alias for |
|
None |
|
Computes arcsine of input tensors element-wise. |
|
None |
|
Computes inverse hyperbolic sine of the input element-wise. |
|
None |
|
Computes the trigonometric inverse tangent of the input element-wise. |
|
None |
|
Returns arctangent of input/other element-wise. |
|
None |
|
Computes inverse hyperbolic tangent of the input element-wise. |
|
None |
|
Reshapes Tensor in inputs, every Tensor has at least one dimension after this operation. |
|
None |
|
Reshapes Tensor in inputs, every Tensor has at least 2 dimension after this operation. |
|
None |
|
Reshapes Tensor in inputs, every Tensor has at least 3 dimension after this operation. |
|
None |
|
Computes modified Bessel function of the first kind, order 0 element-wise. |
|
None |
|
Computes exponential scaled modified Bessel function of the first kind, order 0 element-wise. |
|
None |
|
Computes modified Bessel function of the first kind, order 1 element-wise. |
|
None |
|
Computes exponential scaled modified Bessel function of the first kind, order 1 element-wise. |
|
None |
|
Computes Bessel function of the first kind, order 0 element-wise. |
|
None |
|
Computes Bessel function of the first kind, order 1 element-wise. |
|
None |
|
Computes modified Bessel function of the second kind, order 0 element-wise. |
|
None |
|
Computes exponential scaled modified Bessel function of the second kind, order 0 element-wise. |
|
None |
|
Computes modified Bessel function of the second kind, order 1 element-wise. |
|
None |
|
Computes exponential scaled modified Bessel function of the second kind, order 1 element-wise. |
|
None |
|
Computes Bessel function of the second kind, order 0 element-wise. |
|
None |
|
Computes Bessel function of the second kind, order 1 element-wise. |
|
None |
|
Returns bitwise and of two tensors element-wise. |
|
None |
|
Perform a left bitwise shift operation on the input element-wise, where the number of bits to shift is specified by other. |
|
None |
|
Returns bitwise or of two tensors element-wise. |
|
None |
|
Perform a right bitwise shift operation on the input element-wise, where the number of bits to shift is specified by other. |
|
None |
|
Returns bitwise xor of two tensors element-wise. |
|
None |
|
Rounds a tensor up to the closest integer element-wise. |
|
None |
|
Clamps tensor values between the specified minimum value and maximum value. |
|
None |
|
Alias for |
|
None |
|
Returns all r-length subsequences of input Tensor. |
|
None |
|
Create a new floating-point tensor with the magnitude of x and the sign of other, element-wise. |
|
None |
|
Computes cosine of input element-wise. |
|
Using float64 may cause a problem of missing precision. |
|
Computes hyperbolic cosine of input element-wise. |
|
None |
|
Calculate cosine similarity between x1 and x2 along the axis, dim. |
|
None |
|
Given the input and weights, returns the covariance matrix (the square matrix of the covariance of each pair of variables) of input, where the input row is the variable and the column is the observation value. |
|
The values of fweights and aweights cannot be negative, and the negative weight scene result is undefined. |
|
Creates a tensor with diagonals filled by input. |
|
None |
|
Computes the n-th discrete difference along a specified axis of a given input x. |
|
None |
|
Converts angles in degrees to angles in radians element-wise. |
|
None |
|
Computes the derivative of the lgamma function on input. |
|
This is an experimental API that is subject to change or deletion. |
|
Divides the first input tensor by the second input tensor in floating-point type element-wise. |
|
None |
|
Alias for |
|
None |
|
Computes the Gauss error function of input element-wise. |
|
None |
|
Computes the complementary error function of input element-wise. |
|
None |
|
Returns the result of the inverse error function with input. |
|
None |
|
Returns exponential of a tensor element-wise. |
|
None |
|
Computes base two exponential of Tensor input element-wise. |
|
None |
|
Returns exponential then minus 1 of a tensor element-wise. |
Ascend`` |
None |
|
Rounds a tensor down to the closest integer element-wise. |
|
None |
|
Alias for |
|
None |
|
Divides the first input tensor by the second input tensor element-wise and round down to the closest integer. |
|
This is an experimental API that is subject to change or deletion. |
|
Computes the remainder of division element-wise. |
|
Data of input y should not be 0, or the maximum value of its dtype will be returned. When the elements of input exceeds 2048 , the accuracy of operator cannot guarantee the requirement of double thousandths in the mini form. Due to different architectures, the calculation results of this operator on NPU and CPU may be inconsistent. If shape is expressed as \((D1, D2 ..., Dn)\), then D1*D2... *DN<=1000000,n<=8. |
|
Computes input to the power of the exponent. |
|
None |
|
Computes the floating-point remainder of the division operation input/other. |
|
None |
|
Calculates the fractional part of each element in the input |
|
None |
|
Computes greatest common divisor of input tensors element-wise. |
|
This is an experimental API that is subject to change or deletion. |
|
Computes hypotenuse of input tensors element-wise as legs of a right triangle. |
|
None |
|
Calculates lower regularized incomplete Gamma function. |
|
This is an experimental API that is subject to change or deletion. |
|
Calculates upper regularized incomplete Gamma function. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns a new tensor containing imaginary value of the input. |
|
None |
|
Alias for |
|
None |
|
Computes Reciprocal of input tensor element-wise. |
|
None |
|
Flips all bits of input tensor element-wise. |
|
None |
|
Computes least common multiplier of input tensors element-wise. |
|
None |
|
Multiplies input Tensor by \(2^{other}\) element-wise. |
|
None |
|
Does a linear interpolation of two tensors input and end based on a float or tensor weight. |
|
None |
|
Returns the natural logarithm of a tensor element-wise. |
|
If the input value of operator Log is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affacted. |
|
Returns a new Tensor by taking the base 2 logarithm of the elements in the input Tensor. |
|
If the input value of operator log2 is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affected. |
|
Returns a new Tensor by taking the base 10 logarithm of the elements in the input Tensor. |
|
If the input value of operator log10 is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affected. |
|
Returns the natural logarithm of one plus the input tensor element-wise. |
|
None |
|
Computes the logarithm of the sum of exponentiations of the inputs. |
|
None |
|
Computes the logarithm of the sum of exponentiations in base of 2 of the inputs. |
|
None |
|
Computes the "logical AND" of two tensors element-wise. |
|
None |
|
Computes the "logical NOT" of a tensor element-wise. |
|
None |
|
Computes the "logical OR" of two tensors element-wise. |
|
None |
|
Computes the "logical XOR" of two tensors element-wise. |
|
None |
|
Calculate the logit of a tensor element-wise. |
|
None |
|
Multiplies two tensors element-wise. |
|
None |
|
Alias for |
|
None |
|
Returns the results of the multivariate log-gamma function with dimension p element-wise. |
|
None |
|
Returns a tensor with negative values of the input tensor element-wise. |
|
None |
|
Alias for |
|
None |
|
Returns the next representable floating-point value after input towards other element-wise. |
|
None |
|
Converts polar coordinates to Cartesian coordinates. |
|
None |
|
Computes the \(n\)-th derivative of the polygamma function on input. |
|
None |
|
Return self Tensor. |
|
None |
|
Calculates the exponent power of each element in input. |
|
None |
|
Converts angles in radians to angles in degrees element-wise. |
|
None |
|
Expand the multidimensional Tensor into 1D along the 0 axis direction. |
|
None |
|
Returns a Tensor that is the real part of the input. |
|
None |
|
Returns reciprocal of a tensor element-wise. |
|
None |
|
Computes the remainder of dividing the first input tensor by the second input tensor element-wise. |
|
When the elements of input exceed 2048, there might be accuracy problems. The calculation results of this operator on Ascend and CPU might be inconsistent. If shape is expressed as (D1,D2... ,Dn), then D1*D2... *DN<=1000000,n<=8. |
|
Rotate a n-D tensor by 90 degrees in the plane specified by dims axis. |
|
None |
|
Returns half to even of a tensor element-wise. |
|
None |
|
Computes reciprocal of square root of input tensor element-wise. |
|
None |
|
Extension of |
|
None |
|
Returns an element-wise indication of the sign of a number. |
|
None |
|
Determine the symbol of each element. |
|
None |
|
Computes sine of the input element-wise. |
|
None |
|
Computes the normalized sinc of input. |
|
None |
|
Computes hyperbolic sine of the input element-wise. |
|
None |
|
Returns sqrt of a tensor element-wise. |
|
None |
|
Returns square of a tensor element-wise. |
|
None |
|
Subtracts the second input tensor from the first input tensor element-wise. |
|
None |
|
Performs the element-wise subtract of input tensors. |
|
None |
|
Transposes a 2-D Tensor. |
|
None |
|
Computes tangent of input element-wise. |
|
None |
|
Tanhshrink Activation, \(Tanhshrink(x)=x-Tanh(x)\) , where \(x\) corresponds to input . |
|
None |
|
Integrates y(x) along given dim using trapezoidal rule. |
|
None |
|
Calculates the indices of the lower triangular elements in a row * col matrix and returns them as a 2-by-N Tensor. |
|
None |
|
Calculates the indices of the upper triangular elements in a row * col matrix and returns them as a 2-by-N Tensor. |
|
None |
|
Alias for |
|
None |
|
Returns a new tensor with the truncated integer values of the elements of the input tensor. |
|
None |
|
Divides the first input tensor by the second input tensor element-wise and rounds the results of division towards zero. |
|
None |
|
Returns the remainder of division element-wise. |
|
The input data does not support 0. When the elements of input exceed 2048 , the accuracy of operator cannot guarantee the requirement of double thousandths in the mini form. Due to different architectures, the calculation results of this operator on NPU and CPU may be inconsistent. If shape is expressed as (D1,D2... ,Dn), then D1*D2... *DN<=1000000,n<=8. |
|
Divides the first input tensor by the second input tensor element-wise. |
|
None |
|
Computes the first input tensor multiplied by the logarithm of second input tensor element-wise. |
|
On Ascend, the data type of input and other must be float16 or float32. |
|
Elemental-wise compute the Hurwitz zeta output. |
|
This is an experimental API that is subject to change or deletion. |
Reduction Functions
API Name |
Description |
Supported Platforms |
Warning |
Reduces a dimension of input by the "logical AND" of all elements in the dimension, by default. |
|
None |
|
Reduces all dimensions of a tensor by returning the maximum value in input, by default. |
|
None |
|
Reduces all dimensions of a tensor by returning the minimum value in input, by default. |
|
None |
|
It returns the minimum and maximum value along the given axis of input tensor. |
|
None |
|
Reduces a dimension of input by the "logical OR" of all elements in the dimension, by default. |
|
None |
|
Return the indices of the maximum values of a tensor across a dimension. |
|
None |
|
Returns the indices of the minimum value of a tensor across the axis. |
|
None |
|
Returns a tuple (values,indices) where 'values' is the cumulative maximum value of input Tensor input along the dimension axis, and indices is the index location of each maximum value. |
|
None |
|
Returns a tuple (values,indices) where 'values' is the cumulative minimum value of input Tensor input along the dimension axis, and indices is the index location of each minimum value. |
|
None |
|
Computes the cumulative product of the input tensor along dimension dim. |
|
None |
|
Computes the cumulative sum of input Tensor along axis. |
|
None |
|
Computes the maximum of input tensors element-wise. |
|
None |
|
Computes the histogram of a tensor. |
|
None |
|
Compute the cumulative log-sum-exp of the input tensor input along axis . |
|
This is an experimental API that is subject to change or deletion. |
|
Reduces a dimension of a tensor by calculating exponential for all elements in the dimension, then calculate logarithm of the sum. |
|
None |
|
Calculates the maximum value along with the given axis for the input tensor. |
|
If there are multiple maximum values, the index of the first maximum value is used. The value range of "axis" is [-dims, dims - 1]. "dims" is the dimension length of "input". |
|
Reduces all dimension of a tensor by averaging all elements in the dimension, by default. |
|
None |
|
Computes the median and indices of input tensor. |
|
indices does not necessarily contain the first occurrence of each median value found in the input, unless it is unique. The specific implementation of this API is device-specific. The results may be different on CPU and GPU. |
|
Calculates the minimum value along with the given axis for the input tensor. |
|
If there are multiple minimum values, the index of the first minimum value is used. The value range of "axis" is [-dims, dims - 1]. "dims" is the dimension length of "x". |
|
Returns the matrix norm or vector norm of a given tensor. |
|
None |
|
Reduces a dimension of a tensor by multiplying all elements in the dimension, by default. |
|
None |
|
Returns the standard-deviation of each row of the input Tensor by default, or it can calculate them in specified dimension axis. |
|
None |
|
Returns the standard-deviation and mean of each row of the input Tensor by default, or it can calculate them in specified dimension axis. |
|
None |
|
Returns the variance of each row of the input Tensor by default, or it can calculate them in specified dimension axis. |
|
None |
|
Returns the variance and mean of each row of the input Tensor by default, or it can calculate them in specified dimension axis. |
|
None |
Comparison Functions
API Name |
Description |
Supported Platforms |
Warning |
Sorts the input tensor along the given dimension in specified order and return the sorted indices. |
|
None |
|
Returns |
|
None |
|
Bucketizes input based on boundaries. |
|
None |
|
Computes the equivalence between two tensors element-wise. |
|
None |
|
Computes the equivalence between two tensors element-wise. |
|
None |
|
Computes the boolean value of \(input >= other\) element-wise. |
|
None |
|
Compare the value of the input parameters \(input > other\) element-wise, and the output result is a bool value. |
|
None |
|
Given two Tensors, compares them element-wise to check if each element in the first Tensor is greater than or equal to the corresponding element in the second Tensor. |
|
None |
|
Compare the value of the input parameters \(input,other\) element-wise, and the output result is a bool value. |
|
None |
|
Determines whether the targets are in the top k predictions. |
|
None |
|
Returns a new Tensor with boolean elements representing if each element of input is “close” to the corresponding element of other. |
|
None |
|
Determine which elements are finite for each position. |
|
None |
|
Determines which elements are inf or -inf for each position. |
|
This is an experimental API that is subject to change. For Ascend, it is only supported on platforms above Atlas A2. |
|
Determines which elements are NaN for each position. |
|
None |
|
Tests element-wise for negative infinity. |
|
None |
|
Tests element-wise for positive infinity. |
|
None |
|
Tests element-wise for real number. |
|
None |
|
Return True if the data type of the tensor is complex, otherwise return False. |
|
None |
|
Judge whether the data type of input is a floating point data type i.e., one of mindspore.float64, mindspore.float32, mindspore.float16. |
|
None |
|
Computes the boolean value of \(input <= other\) element-wise. |
|
None |
|
Computes the boolean value of \(input < other\) element-wise. |
|
None |
|
Computes the boolean value of \(input <= other\) element-wise. |
|
None |
|
Alias for |
|
None |
|
Computes the maximum of input tensors element-wise. |
|
If all inputs are scalar of integers. In GRAPH mode, the output will be Tensor of int32, while in PYNATIVE mode, the output will be Tensor of int64. |
|
Computes the minimum of input tensors element-wise. |
|
None |
|
Sorts the elements in Tensor in ascending order of value along its first dimension. |
|
None |
|
Computes the non-equivalence of two tensors element-wise. |
|
None |
|
Alias for |
|
None |
|
Return the position indices such that after inserting the values into the sorted_sequence, the order of innermost dimension of the sorted_sequence remains unchanged. |
|
None |
|
Finds values and indices of the k largest or smallest entries along a given dimension. |
|
If sorted is set to False, it will use the aicpu operator, the performance may be reduced. In addition, due to different memory layout and traversal methods on different platforms, the display order of calculation results may be inconsistent when sorted is False. |
Linear Algebraic Functions
API Name |
Description |
Supported Platforms |
Warning |
Applies batch matrix multiplication to batch1 and batch2, with a reduced add step and add input to the result. |
|
None |
|
Multiplies matrix mat1 and matrix mat2. |
|
None |
|
Computes the outer product of two vector vec1 and vec2, and adds the resulting matrix to x. |
|
None |
|
Calculates the conjugation of Tensor element by element, and transposes the last two dimensions. |
|
None |
|
The result is the sum of the input and a batch matrix-matrix product of matrices in batch1 and batch2. |
|
None |
|
Computation of batch dot product between samples in two tensors containing batch dims, i.e. x1 or x2 's first dimension is batch size. |
|
None |
|
Computes matrix multiplication between two tensors by batch. |
|
None |
|
Returns the Cholesky decomposition of zero or more batch dimensions consisting of symmetric positive-definite matrices. |
|
None |
|
Computes the solution of a set of linear equations with a positive definite matrix, according to its Cholesky decomposition factor input2 . |
|
This is an experimental API that is subject to change or deletion. |
|
Returns the matrix norm or vector norm of a given tensor. |
|
None |
|
Computation a dot product between samples in two tensors. |
|
None |
|
Computes the eigenvalues of a square matrix(batch square matrices). |
|
This is an experimental API that is subject to change or deletion. |
|
Decomposes a matrix into the product of an orthogonal matrix Q and an upper triangular matrix R. |
|
This is an experimental API that is subject to change or deletion. |
|
Ger product of input and vec2. |
|
None |
|
Returns the inner product of two tensors. |
|
None |
|
Compute the inverse of the input matrix. |
|
None |
|
Computes the Kronecker product \(input ⊗ other\), denoted by ⊗, of input and other. |
|
None |
|
Calculates log determinant of one or a batch of square matrices. |
|
None |
|
Computes the solution y to the system of linear equations \(Ay = b\) , given LU decomposition \(A\) and column vector \(b\). |
|
This is an experimental API that is subject to change or deletion. |
|
Converts LU_data and LU_pivots back into P, L and U matrices, where P is a permutation matrix, L is a lower triangular matrix, and U is an upper triangular matrix. |
|
None |
|
Returns the matrix product of two tensors. |
|
None |
|
Copy a tensor setting everything outside a central band in each innermost matrix to zero. |
|
This is an experimental API that is subject to change or deletion. |
|
Solves systems of linear equations. |
|
On GPU, if the matrix is irreversible, an error may be reported or an unknown result may be returned. |
|
Copy a tensor setting everything outside a central band in each innermost matrix to zero. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns a Tensor with the contents in x as k[0]-th to k[1]-th diagonals of a matrix, with everything else padded with padding_value. |
|
None |
|
Returns the diagonal part of input tensor. |
|
None |
|
Returns a batched matrix tensor with new batched diagonal values. |
|
None |
|
Returns the matrix product of two arrays. |
|
None |
|
Multiplies matrix mat and vector vec. |
|
None |
|
Return outer product of input and vec2. |
|
None |
|
Calculates two matrices multiplication of a product of a general matrix with Householder matrices. |
|
None |
|
Calculates the explicit representation of the orthogonal matrix \(Q\) returned by |
|
None |
|
Calculates two matrices multiplication of a product of a general matrix with Householder matrices. |
|
None |
|
Computes the (Moore-Penrose) pseudo-inverse of a matrix. |
|
None |
|
Computes the singular value decompositions of one or more matrices. |
|
None |
|
Computes the sign and the log of the absolute value of the determinant of one or more square matrices. |
|
None |
|
Returns a new tensor that is the sum of the input main trace. |
|
None |
|
Computation of Tensor contraction on arbitrary axes between tensors a and b. |
|
None |
|
Generates a Vandermonde matrix. |
|
None |
|
Calculates the dot product of two batches of vectors across the specified dimension. |
|
This is an experimental API that is subject to change or deletion. |
Spectral Functions
API Name |
Description |
Supported Platforms |
Warning |
Bartlett window function is a triangular-shaped weighting function used for smoothing or frequency analysis of signals in digital signal processing. |
|
None |
|
Blackman window function, usually used to extract finite signal segment for FFT. |
|
None |
|
Returns the Hamming window. |
|
None |
|
Generates a Hann Window. |
|
None |
|
Generates a Kaiser window, which is also known as the Kaiser-Bessel window. |
|
None |
Tensor Operation Functions
Tensor Creation
API Name |
Description |
Supported Platforms |
Warning |
Create a Tensor with the same data type and shape as input, and the element value is the minimum value that the corresponding data type can express. |
|
None |
|
Creates a tensor with ones on the diagonal and zeros in the rest. |
|
None |
|
Create a Tensor of the specified shape and fill it with the specified value. |
|
None |
|
Create a Tensor of the specified shape and fill it with the specified value. |
|
None |
|
Return a Tensor of the same shape as input and filled with fill_value. |
|
None |
|
Returns a Tensor whose value is steps evenly spaced in the interval start and end (including start and end), and the length of the output Tensor is steps. |
|
None |
|
Returns a 1-D Tensor with size steps whose value is from \(base^{start}\) to \(base^{end}\), and use base as the base number. |
|
None |
|
Computes a one-hot tensor. |
|
None |
|
Creates a tensor filled with value ones, whose shape and type are described by the first argument size and second argument dtype respectively. |
|
For argument shape, Tensor type input will be deprecated in the future version. |
|
Returns a Tensor with a value of 1 and its shape is the same as the input. |
|
None |
|
Creates a sequence of numbers that begins at start and extends by increments of step up to but not including end. |
|
None |
|
Creates a sequence of numbers that begins at start and extends by increments of step up to but not including end. |
|
None |
|
Creates a tensor filled with value zeros, whose shape and type are described by the first argument size and second argument dtype respectively. |
|
For argument size, Tensor type input will be deprecated in the future version. |
|
Creates a tensor filled with 0, with the same size as input, and the given dtype. |
|
None |
|
Computes the Heaviside step function for each element in input. |
|
None |
Randomly Generating Functions
API Name |
Description |
Supported Platforms |
Warning |
Randomly set the elements of output to 0 or 1 with the probability of p which follows the Bernoulli distribution. |
|
None |
|
Generates random numbers according to the Gamma random number distribution. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Generates random numbers according to the Laplace random number distribution. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Returns a tensor sampled from the multinomial probability distribution located in the corresponding row of the input tensor. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Returns a tensor where each row contains numsamples indices sampled from the multinomial distribution with replacement. |
|
None |
|
Returns a new tensor that fills numbers from the uniform distribution over an interval \([0, 1)\) based on the given shape and dtype. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Returns a new tensor that fills numbers from the uniform distribution over an interval \([0, 1)\) based on the given shape and dtype. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Returns a Tensor whose elements are random integers in the range of [ low , high ) . |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Returns a tensor with the same shape as Tensor input whose elements are random integers in the range of [ low , high ) . |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Returns a new Tensor with given shape and dtype, filled with a sample (or samples) from the standard normal distribution. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Returns a new Tensor with given shape and dtype, filled with a sample (or samples) from the standard normal distribution. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Outputs random values from the Gamma distribution(s) described by alpha. |
|
None |
|
Generates random number Tensor with shape shape according to a Poisson distribution with mean rate. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Generates random permutation of integers from 0 to n-1. |
|
This is an experimental API that is subject to change or deletion. The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Generates random numbers according to the Laplace random number distribution (mean=0, lambda=1). |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Generates random numbers according to the standard Normal (or Gaussian) random number distribution. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Generates random numbers according to the Uniform random number distribution. |
|
None |
Array Operation
API Name |
Description |
Supported Platforms |
Warning |
Return a Tensor of the positions of all non-zero values. |
|
None |
|
Divides batch dimension with blocks and interleaves these blocks back into spatial dimensions. |
|
None |
|
Counts the number of occurrences of each value in input. |
|
None |
|
Creates a block diagonal matrix from the provided Tensor. |
|
None |
|
Broadcasts input tensor to a given shape. |
|
None |
|
Connect input tensors along with the given axis. |
|
None |
|
Divide the channels in a tensor of shape \((*, C, H, W)\) into \(g\) groups and rearrange them as \((*, \frac{C}{g}, g, H*W)\), while keeping the original tensor shapes. |
|
None |
|
Cut the input Tensor into chunks sub-tensors along the specified axis. |
|
None |
|
Stacks 1-D tensors as columns into a 2-D tensor. |
|
None |
|
Alias for |
|
None |
|
Returns a tensor of complex numbers that are the complex conjugate of each element in input. |
|
None |
|
Count number of nonzero elements across axis of input tensor. |
|
None |
|
Returns a deepcopy of input tensor. |
|
None |
|
Constructs a diagonal tensor with a given diagonal values. |
|
This is an experimental API that is subject to change or deletion. |
|
Create a 2-D Tensor which diagonal is the flattened input . |
|
None |
|
Returns specified diagonals of input. |
|
None |
|
dim1 and dim2 specify the two dimensions of input, the elements in these two dimensions will be treated as elements of a matrix, and src is embedded on the diagonal of the matrix. |
|
None |
|
Returns the shape of the input tensor. |
|
None |
|
Splits a tensor into multiple sub-tensors along the 3rd axis. |
|
None |
|
Stacks tensors along the third axis. |
|
None |
|
According to the Einstein summation Convention (Einsum), the product of the input tensor elements is summed along the specified dimension. |
|
None |
|
Adds an additional dimension to input_x at the given axis, the dimension of input_x should be greater than or equal to 1. |
|
None |
|
Reverses the order of elements in a tensor along the given axis. |
|
None |
|
Flips the elements of each row in the left/right direction, while preserving the columns of the input tensor. |
|
None |
|
Flips the elements of each column in the up/down direction, while preserving the rows of the input tensor. |
|
None |
|
Returns the slice of the input tensor corresponding to the elements of input_indices on the specified axis. |
|
None |
|
Gathers elements along an axis specified by dim. |
|
None |
|
Gathers elements along an axis specified by dim. |
|
On Ascend, the behavior is unpredictable in the following cases: the value of index is not in the range [-input.shape[dim], input.shape[dim]) in forward; the value of index is not in the range [0, input.shape[dim]) in backward. |
|
Gathers slices from a tensor by indices. |
|
None |
|
Stacks tensors in sequence horizontally. |
|
None |
|
Splits a tensor into multiple sub-tensors horizontally. |
|
None |
|
Adds tensor y to specified axis and indices of Parameter x. |
|
None |
|
Fills the elements under the axis dimension of the input Tensor x with the input value by selecting the indices in the order given in index. |
|
None |
|
Generates a new Tensor that accesses the values of input along the specified axis dimension using the indices specified in index. |
|
None |
|
Adds v into specified rows of x. |
|
None |
|
Adds Tensor updates to specified axis and indices of Tensor var element-wise. |
|
None |
|
Subtracts v into specified rows of x. |
|
None |
|
Updates specified values in x to v according to indices. |
|
This is an experimental API that is subject to change or deletion. |
|
Determine whether the input Tensor contains 0 or False. |
|
None |
|
Fills elements of Tensor with value where mask is True. |
|
None |
|
Returns a new 1-D Tensor which indexes the input tensor according to the boolean mask. |
|
None |
|
Generates coordinate matrices from given coordinate tensors. |
|
None |
|
Obtains a tensor of a specified length at a specified start position along a specified axis. |
|
None |
|
Alias for ops.movedim. |
|
None |
|
Moves axis of an array from source to destination. |
|
None |
|
Replace the NaN, positive infinity and negative infinity values in input with the specified values in nan, posinf and neginf respectively. |
|
For Ascend, it is only supported on Atlas A2 Training Series Products. This is an experimental API that is subject to change or deletion. |
|
Computes the mean of input in specified dimension, ignoring NaN. |
|
None |
|
Computes the median and indices of input in specified dimension, ignoring NaN. |
|
indices does not necessarily contain the first occurrence of each median value found in the input, unless it is unique. |
|
Computes sum of input over a given dimension, treating NaNs as zero. |
|
None |
|
Generates random numbers according to the Normal (or Gaussian) random number distribution. |
|
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. |
|
Return the positions of all non-zero values. |
|
None |
|
Returns a Scalar of type int that represents the total number of elements in the Tensor. |
|
None |
|
Permutes the dimensions of the input tensor according to input axis . |
|
None |
|
Computes element-wise population count(a.k.a bitsum, bitcount). |
|
None |
|
Returns the rank of a tensor. |
|
None |
|
Repeat elements of a tensor along an axis, like numpy.repeat . |
|
None |
|
Repeat elements of a tensor along an axis, like numpy.repeat. |
|
None |
|
Rearranges the input Tensor based on the given shape. |
|
None |
|
|
|
None |
|
Reverses variable length slices. |
|
None |
|
Rolls the elements of a tensor along an axis. |
|
None |
|
Alias for |
|
None |
|
Update the value in src to input according to the specified index. |
|
None |
|
Scatters a tensor into a new tensor depending on the specified indices. |
|
None |
|
The conditional tensor determines whether the corresponding element in the output must be selected from input (if True) or other (if False) based on the value of each element. |
|
None |
|
On the specified dimension axis of input , src is scattered into input on the specified index of input . |
|
None |
|
Returns a mask tensor representing the first N positions of each cell. |
|
None |
|
Returns the shape of the input tensor. |
|
None |
|
Randomly shuffles a Tensor along its first dimension. |
|
None |
|
Returns a Scalar of type int that represents the size of the input Tensor and the total number of elements in the Tensor. |
|
None |
|
Slices a tensor in the specified shape. |
|
None |
|
Slice the input Tensor in the specified dimension and overlay the slice results with the source Tensor. |
|
None |
|
Sorts the elements of the input tensor along the given dimension in the specified order. |
|
Currently, the data types of float16, uint8, int8, int16, int32, int64 are well supported. If use float32, it may cause loss of accuracy. |
|
Divides a tensor's spatial dimensions into blocks and combines the block sizes with the original batch. |
|
None |
|
Computes a Tensor such that \(output_i = \frac{\sum_j x_{indices[j]}}{N}\) where mean is over \(j\) such that \(segment\_ids[j] == i\) and \(N\) is the total number of values summed. |
|
None |
|
Splits the Tensor into chunks along the given axis. |
|
None |
|
Return the Tensor after deleting the dimension of size 1 in the specified axis. |
|
None |
|
Stacks a list of tensors in specified axis. |
|
None |
|
Extracts a strided slice of a Tensor based on begin/end index and strides. |
|
None |
|
Calculate sum of Tensor elements over a given dim. |
|
None |
|
Interchange two axes of a tensor. |
|
None |
|
Interchange two dims of a tensor. |
|
None |
|
Creates a new tensor by adding the values from the positions in input_x indicated by indices, with values from updates. |
|
None |
|
Creates a new tensor by dividing the values from the positions in input_x indicated by indices, with values from updates. |
|
None |
|
By comparing the value at the position indicated by indices in input_x with the value in the updates, the value at the index will eventually be equal to the largest one to create a new tensor. |
|
None |
|
By comparing the value at the position indicated by indices in input_x with the value in the updates, the value at the index will eventually be equal to the smallest one to create a new tensor. |
|
None |
|
Creates a new tensor by multiplying the values from the positions in input_x indicated by indices, with values from updates. |
|
None |
|
Creates a new tensor by subtracting the values from the positions in input_x indicated by indices, with values from updates. |
|
None |
|
Write all elements in updates to the index specified by indices in input_x according to the reduction operation specified by reduction. |
|
The order in which updates are applied is nondeterministic, meaning that if there are multiple index vectors in indices that correspond to the same position, the value of that position in the output will be nondeterministic. On Ascend, the reduction only support set to "none" for now. On Ascend, the data type of input_x must be float16 or float32. This is an experimental API that is subject to change or deletion. |
|
Splits a tensor into multiple sub-tensors along the given axis. |
|
None |
|
Creates a new tensor by repeating input dims times. |
|
None |
|
Returns the lower triangle part of input (elements that contain the diagonal and below), and set the other elements to zeros. |
|
None |
|
Returns the upper triangle part of input (elements that contain the diagonal and below), and set the other elements to zeros. |
|
This is an experimental API that is subject to change or deletion. |
|
Permutes the dimensions of the input tensor according to input permutation. |
|
None |
|
Removes a tensor dimension in specified axis. |
|
None |
|
Extracts sliding local blocks from a batched input tensor. |
|
The output is a 3-dimensional Tensor whose shape is \((N, C \times \prod(\text{kernel_size}), L)\) . This is an experimental API that is subject to change or deletion. |
|
Returns the unique elements of input tensor and also return a tensor containing the index of each value of input tensor corresponding to the output unique tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns the elements that are unique in each consecutive group of equivalent elements in the input tensor. |
|
None |
|
Returns unique elements and relative indexes in 1-D tensor, filled with padding num. |
Deprecated |
|
|
Computes the maximum along segments of a tensor. |
|
None |
|
Computes the minimum of a tensor along segments. |
|
None |
|
Computes the product of a tensor along segments. |
|
None |
|
Computes the sum of a tensor along segments. |
|
None |
|
Adds an additional dimension to input at the given dim. |
|
None |
|
Unstacks tensor in specified axis, this is the opposite of |
|
None |
|
View a complex Tensor as a real Tensor. |
|
None |
|
Splits input with two or more dimensions, into multiple sub-tensors vertically according to indices_or_sections. |
|
None |
|
Stacks tensors in sequence vertically. |
|
None |
|
Selects elements from input or other based on condition and returns a tensor. |
|
None |
|
Computes the cross product of input and other in dimension dim. |
|
None |
|
Renormalizes the sub-tensors along dimension axis, and each sub-tensor's p-norm should not exceed the maxnorm. |
|
None |
Type Cast
API Name |
Description |
Supported Platforms |
Warning |
Returns a tensor with the new specified data type. |
|
None |
|
Check whether the input object is a |
|
None |
|
The interface is deprecated from version 2.3 and will be removed in a future version, please use int(x) or float(x) instead. |
Deprecated |
None |
|
Converts a scalar to a Tensor, and converts the data type to the specified type. |
|
None |
|
Converts a tuple to a tensor. |
|
None |
Gradient Clipping
API Name |
Description |
Supported Platforms |
Warning |
Clips tensor values by the ratio of the sum of their norms. |
|
None |
|
Clips tensor values to a specified min and max. |
|
None |
|
Clip norm of a set of input Tensors. |
|
None |
Parameter Operation Functions
API Name |
Description |
Supported Platforms |
Warning |
Assigns Parameter or Tensor with a value. |
|
None |
|
Updates a Parameter or Tensor by adding a value to it. |
|
None |
|
Updates a Parameter or Tensor by subtracting a value from it. |
|
None |
|
Using given values to update tensor value through the add operation, along with the input indices. |
|
None |
|
Using given values to update tensor value through the div operation, along with the input indices. |
|
None |
|
Using given values to update tensor value through the min operation, along with the input indices. |
|
None |
|
Using given values to update tensor value through the max operation, along with the input indices. |
|
None |
|
Using given values to update tensor value through the mul operation, along with the input indices. |
|
None |
|
Applies sparse addition to individual values or slices in a tensor. |
|
None |
|
Applying sparse division to individual values or slices in a tensor. |
|
None |
|
Applying sparse maximum to individual values or slices in a tensor. |
|
None |
|
Applying sparse minimum to individual values or slices in a tensor. |
|
None |
|
Applies sparse multiplication to individual values or slices in a tensor. |
|
None |
|
Applies sparse subtraction to individual values or slices in a tensor. |
|
None |
|
Updates tensor values by using input indices and value. |
|
None |
Differential Functions
API Name |
Description |
Supported Platforms |
Warning |
This function is designed to calculate the higher order differentiation of given composite function. |
|
None |
|
This function is designed to calculate the higher order differentiation of given composite function. |
|
None |
|
StopGradient is used for eliminating the effect of a value on the gradient, such as truncating the gradient propagation from an output of a function. |
|
None |
Debugging Functions
API Name |
Description |
Supported Platforms |
Warning |
Outputs the inputs to stdout. |
|
None |
|
Save Tensor in numpy's npy format. |
|
The parameter mode will no longer support the value 'all'. |
Sparse Functions
Warning
These are experimental APIs that are subject to change or deletion.
API Name |
Description |
Supported Platforms |
Warning |
Convert a Tensor to COOTensor. |
|
None |
|
Convert a Tensor to CSRTensor. |
|
None |
|
Converts a CSRTensor to COOTensor. |
|
None |
COO Functions
Warning
These are experimental APIs that are subject to change or deletion.
API Name |
Description |
Supported Platforms |
Warning |
Returns coo_absolute value of a COOTensor element-wise. |
|
None |
|
Computes arccosine of input coo_tensors element-wise. |
|
None |
|
Computes inverse hyperbolic cosine of the inputs element-wise. |
|
Given an input COOTensor x, the function computes inverse hyperbolic cosine of every element. Input range is [1, inf]. |
|
Computes the sum of x1(COOTensor) and x2(COOTensor), and return a new COOTensor based on the computed result and thresh. |
|
None |
|
Computes arcsine of input coo_tensors element-wise. |
|
None |
|
Computes inverse hyperbolic sine of the input element-wise. |
|
None |
|
Computes the trigonometric inverse tangent of the input element-wise. |
|
None |
|
Computes inverse hyperbolic tangent of the input element-wise. |
|
This is an experimental API that is subject to change or deletion. |
|
Rounds a COOTensor up to the closest integer element-wise. |
|
None |
|
concatenates the input SparseTensor(COO format) along the specified dimension. |
|
This is an experimental API that is subjected to change or deletion. Only supported on CPU now. |
|
Computes cosine of input element-wise. |
|
If use float64, there may be a problem of missing precision. |
|
Computes hyperbolic cosine of input element-wise. |
|
None |
|
Returns the element-wise exponential of a COOTensor. |
|
None |
|
Returns exponential then minus 1 of a COOTensor element-wise. |
|
None |
|
Rounds a COOTensor down to the closest integer element-wise. |
|
None |
|
Computes Reciprocal of input COOTensor element-wise. |
|
None |
|
Determines which elements are finite for each position. |
|
None |
|
Determines which elements are inf or -inf for each position. |
|
None |
|
Determines which elements are NaN for each position. |
|
None |
|
Returns the natural logarithm of a COOTensor element-wise. |
|
If the input value of operator Log is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affacted. |
|
Returns the natural logarithm of one plus the input COOTensor element-wise. |
|
None |
|
Returns a COOTensor with coo_negative values of the input COOTensor element-wise. |
|
None |
|
Computes ReLU (Rectified Linear Unit activation function) of input coo_tensors element-wise. |
|
None |
|
Computes ReLU (Rectified Linear Unit) upper bounded by 6 of input coo_tensors element-wise. |
|
None |
|
Returns half to even of a COOTensor element-wise. |
|
None |
|
Sigmoid activation function. |
|
None |
|
Computes sine of the input element-wise. |
|
None |
|
Computes hyperbolic sine of the input element-wise. |
|
None |
|
Softsign activation function. |
|
None |
|
Returns sqrt of a COOTensor element-wise. |
|
None |
|
Returns square of a COOTensor element-wise. |
|
None |
|
Computes tangent of x element-wise. |
|
None |
|
Computes hyperbolic tangent of input element-wise. |
|
None |
CSR Functions
Warning
These are experimental APIs that are subject to change or deletion.
API Name |
Description |
Supported Platforms |
Warning |
Returns csr_absolute value of a CSRTensor element-wise. |
|
None |
|
Computes arccosine of input csr_tensors element-wise. |
|
None |
|
Computes inverse hyperbolic cosine of the inputs element-wise. |
|
None |
|
Computes the linear combination of two input CSRTensors a and b. |
|
None |
|
Computes arcsine of input csr_tensors element-wise. |
|
None |
|
Computes inverse hyperbolic sine of the input element-wise. |
|
None |
|
Computes the trigonometric inverse tangent of the input element-wise. |
|
None |
|
Computes inverse hyperbolic tangent of the input element-wise. |
|
This is an experimental API that is subject to change or deletion. |
|
Rounds a CSRTensor up to the closest integer element-wise. |
|
None |
|
Computes cosine of input element-wise. |
|
Currently support data types float16 and float32. If use float64, there may be a problem of missing precision. |
|
Computes hyperbolic cosine of input element-wise. |
|
None |
|
Returns csr_exponential of a CSRTensor element-wise. |
|
None |
|
Returns exponential then minus 1 of a CSRTensor element-wise. |
|
None |
|
Rounds a CSRTensor down to the closest integer element-wise. |
|
None |
|
Computes Reciprocal of input CSRTensor element-wise. |
|
None |
|
Determines which elements are finite for each position. |
|
None |
|
Determines which elements are inf or -inf for each position. |
|
None |
|
Determines which elements are NaN for each position. |
|
None |
|
Returns the natural logarithm of a CSRTensor element-wise. |
|
If the input value of operator Log is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affacted. |
|
Returns the natural logarithm of one plus the input CSRTensor element-wise. |
|
None |
|
Return the matrix multiplication result of the right-multiply matrix (dense or CSRTensor) of the CSRTensor. |
|
None |
|
Returns a CSRTensor with csr_negative values of the input CSRTensor element-wise. |
|
None |
|
Computes ReLU (Rectified Linear Unit activation function) of input csr_tensors element-wise. |
|
None |
|
Computes ReLU (Rectified Linear Unit) upper bounded by 6 of input csr_tensors element-wise. |
|
None |
|
Returns half to even of a CSRTensor element-wise. |
|
None |
|
Sigmoid activation function. |
|
None |
|
Computes sine of the input element-wise. |
|
None |
|
Computes hyperbolic sine of the input element-wise. |
|
None |
|
Calculates the softmax of a CSRTensorMatrix. |
|
None |
|
Softsign activation function. |
|
None |
|
Returns sqrt of a CSRTensor element-wise. |
|
None |
|
Returns square of a CSRTensor element-wise. |
|
None |
|
Computes tangent of x element-wise. |
|
None |
|
Computes hyperbolic tangent of input element-wise. |
|
None |
MC2 Functions
Warning
These are experimental APIs that are subject to change or deletion.
API Name |
Description |
Supported Platforms |
Warning |
In the TP segmentation scenario, allgather and matmul are fused, and communication and computational pipelines are parallelized within the fusion operator. |
|
This is an experimental API that is subject to change or deletion. |
|
In the TP segmentation scenario, matmul and reducescatter are fused, and communication and computational pipelines are parallelized within the fusion operator. |
|
This is an experimental API that is subject to change or deletion. |