mindspore.mint
mindspore.mint provides a large number of functional, nn, optimizer interfaces. The API usages and functions are consistent with the mainstream usage in the industry for easy reference. The mint interface is currently an experimental interface and performs better than ops in graph mode of O0 and PyNative mode. Currently, the graph sinking mode and CPU/GPU backend are not supported, and it will be gradually improved in the future.
The module import method is as follows:
from mindspore import mint
Compared with the previous version, the added, deleted and supported platforms change information of mindspore.mint operators in MindSpore, please refer to the link mindspore.mint API Interface Change .
Tensor
Creation Operations
API Name |
Description |
Supported Platforms |
Warning |
Creates a sequence of numbers that begins at start and extends by increments of step up to but not including end. |
|
None |
|
Sample from the Bernoulli distribution and randomly set the i^{th} element of the output to (0 or 1) according to the i^{th} probability value given in the input. |
|
This is an experimental API that is subject to change or deletion. |
|
Count the occurrences of each value in the input. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns a copy of the input tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns a tensor with ones on the diagonal and zeros in the rest. |
|
None |
|
According to the Einstein summation Convention (Einsum), the product of the input tensor elements is summed along the specified dimension. |
|
This is an experimental API that is subject to change or deletion. |
|
Creates a tensor with uninitialized data, whose shape, dtype and device are described by the argument size, dtype and device respectively. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns an uninitialized Tensor with the same shape as the input. |
|
This is an experimental API that is subject to change or deletion. |
|
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. |
|
This is an experimental API that is subject to change or deletion. |
|
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. |
|
Atlas training series does not support int16 dtype currently. |
|
Creates a tensor filled with value ones. |
|
None |
|
Creates a tensor filled with 1, with the same shape as input, and its data type is determined by the given dtype. |
|
None |
|
Returns a new tensor filled with integer numbers from the uniform distribution over an interval \([low, high)\) based on the given shape and dtype. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns a new tensor filled with integer numbers from the uniform distribution over an interval \([low, high)\) based on the given dtype and shape of the input tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns a new tensor filled with numbers from the normal distribution over an interval \([0, 1)\) based on the given shape and dtype. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns a new tensor filled with numbers from the normal distribution over an interval \([0, 1)\) based on the given dtype and shape of the input tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Generates random permutation of integers from 0 to n-1. |
|
This is an experimental API that is subject to change or deletion. |
|
Creates a tensor filled with 0 with shape described by size and fills it with value 0 in type of dtype. |
|
None |
|
Creates a tensor filled with 0, with the same size as input. |
|
None |
Indexing, Slicing, Joining, Mutating Operations
API Name |
Description |
Supported Platforms |
Warning |
Connect input tensors along with the given dimension. |
|
None |
|
Cut the input Tensor into chunks sub-tensors along the specified axis. |
|
This is an experimental API that is subject to change or deletion. |
|
Alias for |
|
This is an experimental API that is subject to change or deletion. |
|
Counts the number of non-zero values in the tensor input along the given dim. |
|
This is an experimental API that is subject to change or deletion. |
|
Gather data from a tensor by indices. |
|
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. |
|
Generates a new Tensor that accesses the values of input along the specified dim dimension using the indices specified in index. |
|
None |
|
Returns a new 1-D Tensor which indexes the input tensor according to the boolean mask. |
|
None |
|
Permutes the dimensions of the input tensor according to input dims . |
|
None |
|
Rearranges the input Tensor based on the given shape. |
|
None |
|
Update the value in src to input according to the specified index. |
|
None |
|
Add all elements in src to the index specified by index to input along dimension specified by dim. |
|
None |
|
Splits the Tensor into chunks along the given dim. |
|
None |
|
Obtains a tensor of a specified length at a specified start position along a specified axis. |
|
None |
|
Return the positions of all non-zero values. |
|
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 |
|
Slices the input tensor along the selected dimension at the given index. |
|
This is an experimental API that is subject to change or deletion. |
|
Return the Tensor after deleting the dimension of size 1 in the specified dim. |
|
This is an experimental API that is subject to change or deletion. |
|
Stacks a list of tensors in specified dim. |
|
None |
|
Alias for |
|
This is an experimental API that is subject to change or deletion. |
|
Interchange two axes of a tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
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. |
|
Unbind a tensor dimension in specified axis. |
|
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. |
|
This is an experimental API that is subject to change or deletion. |
|
Adds an additional dimension to input at the given dim. |
|
None |
|
Selects elements from input or other based on condition and returns a tensor. |
|
None |
Random Sampling
API Name |
Description |
Supported Platforms |
Warning |
Returns a tensor sampled from the multinomial probability distribution located in the corresponding row of the input tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Generates random numbers according to the standard Normal (or Gaussian) random number distribution. |
|
None |
|
Returns a new tensor that fills numbers from the uniform distribution over an interval \([0, 1)\) based on the given dtype and shape of the input tensor. |
|
None |
|
Returns a new tensor that fills numbers from the uniform distribution over an interval \([0, 1)\) based on the given shape and dtype. |
|
None |
Math Operations
Pointwise Operations
API Name |
Description |
Supported Platforms |
Warning |
Returns absolute value of a tensor element-wise. |
|
None |
|
Adds scaled other value to self. |
|
None |
|
Performs a matrix-vector product of mat and vec, and add the input vector input to the final result. |
|
This is an experimental API that is subject to change or deletion. |
|
Computes arccosine of input tensors element-wise. |
|
None |
|
Computes inverse hyperbolic cosine of the inputs element-wise. |
|
None |
|
Alias for |
|
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 |
|
Returns bitwise and of two tensors element-wise. |
|
None |
|
Returns bitwise or of two tensors element-wise. |
|
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 |
|
Computes cosine of input element-wise. |
|
Using float64 may cause a problem of missing precision. |
|
Computes hyperbolic cosine of input element-wise. |
|
None |
|
Computes the cross product of input and other in dimension dim. |
|
None |
|
Computes the n-th forward difference along the given dimension. |
|
This is an experimental API that is subject to change or deletion. |
|
Divides each element of the input by the corresponding element of the other . |
|
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 |
|
Calculates the base-2 exponent of the Tensor input element by element. |
|
None |
|
Returns exponential then minus 1 of a tensor element-wise. |
|
None |
|
Alias for |
|
None |
|
Computes input to the power of exponent element-wise in double precision, and always returns a mindspore.float64 tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Rounds a tensor down to the closest integer element-wise. |
|
None |
|
Computes the floating-point remainder of the division operation input/other. |
|
This is an experimental API that is subject to change or deletion. |
|
Calculates the fractional part of each element in the input. |
|
This is an experimental API that is subject to change or deletion. |
|
Perform a linear interpolation of two tensors input and end based on a float or tensor weight. |
|
This is an experimental API that is subject to change or deletion. |
|
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 the natural logarithm of one plus the input tensor element-wise. |
|
None |
|
Returns the logarithm to the base 2 of a tensor element-wise. |
|
This is an experimental API that is subject to change or deletion. If the input value of operator Log2 is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affacted. |
|
Returns the logarithm to the base 10 of a tensor element-wise. |
|
This is an experimental API that is subject to change or deletion. If the input value of operator Log10 is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affacted. |
|
Computes the logarithm of the sum of exponentiations of the inputs. |
|
This is an experimental API that is subject to change or deletion. |
|
Logarithm of the sum of exponentiations of the inputs in base of 2. |
|
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 |
|
Multiply other value by input Tensor. |
|
None |
|
Multiply matrix input and vector vec. |
|
This is an experimental API that is subject to change or deletion. |
|
Computes sum of input over a given dimension, treating NaNs as zero. |
|
It is only supported on Atlas A2 Training Series Products. This is an experimental API that is subject to change or deletion. |
|
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. |
|
Returns a tensor with negative values of the input tensor element-wise. |
|
None |
|
Alias for |
|
None |
|
Calculates the exponent power of each element in input. |
|
This is an experimental API that is subject to change or deletion. |
|
Converts polar coordinates to Cartesian coordinates. |
|
None |
|
Expand the multidimensional Tensor into 1D along the 0 axis direction. |
|
None |
|
Returns reciprocal of a tensor element-wise. |
|
None |
|
Computes the remainder of input divided by other element-wise. |
|
None |
|
Rolls the elements of a tensor along an axis. |
|
None |
|
Returns half to even of a tensor element-wise. |
|
None |
|
Computes reciprocal of square root of input tensor element-wise. |
|
None |
|
Computes Sigmoid of input element-wise. |
|
None |
|
Returns an element-wise indication of the sign of a number. |
|
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 |
|
Alias for |
|
None |
|
Returns sqrt of a tensor element-wise. |
|
None |
|
Returns square of a tensor element-wise. |
|
None |
|
Subtracts scaled other value from self Tensor. |
|
None |
|
Transpose the input tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Computes tangent of input element-wise. |
|
None |
|
Computes hyperbolic tangent of input element-wise. |
|
None |
|
Returns a new tensor with the truncated integer values of the elements of the input tensor. |
|
None |
|
Computes the first input multiplied by the logarithm of second input element-wise. |
|
None |
Reduction Operations
API Name |
Description |
Supported Platforms |
Warning |
Computes the maximum value of of all elements along the specified dim dimension of the input, and retains the dimension based on the keepdim parameter. |
|
This is an experimental API that is subject to change or deletion. |
|
Computes the minimum value of of all elements along the specified dim dimension of the input, and retains the dimension based on the keepdim parameter. |
|
This is an experimental API that is subject to change or deletion. |
|
Return the indices of the maximum values of a tensor. |
|
None |
|
Return the indices of the minimum values of a tensor across a dimension. |
|
None |
|
Reduces all elements of input by the "logical AND". |
|
None |
|
Reduces a dimension of input by the "logical OR" of all elements in the dimension, by default. |
|
None |
|
Computes the cumulative product of the input tensor along dimension dim. |
|
None |
|
Computes the histogram of a tensor. |
|
This is an experimental API that is subject to change or deletion. If input is int64, valid values fit within int32; exceeding this may cause precision errors. |
|
Computes the logarithm of the sum of exponentiations of all elements along the specified dim dimension of the input (with numerical stabilization), and retains the dimension based on the keepdim parameter. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns the maximum value of the input tensor. |
|
None |
|
Reduces all dimension of a tensor by averaging all elements. |
|
None |
|
Output the median on the specified dimension |
|
None |
|
Returns the minimum value of the input tensor. |
|
None |
|
Returns the matrix norm or vector norm of a given tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Multiplying all elements of input. |
|
None |
|
Calculate sum of all elements in Tensor. |
|
None |
|
Calculates the standard deviation over the dimensions specified by dim. |
|
This is an experimental API that is subject to change or deletion. |
|
By default, return the standard deviation and mean of each dimension in Tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns the unique elements of input tensor. |
|
None |
|
Calculates the variance over the dimensions specified by dim. |
|
This is an experimental API that is subject to change or deletion. |
|
By default, return the variance and mean of each dimension in Tensor. |
|
This is an experimental API that is subject to change or deletion. |
Comparison Operations
API Name |
Description |
Supported Platforms |
Warning |
Returns a new Tensor with boolean elements representing if each element of input is “close” to the corresponding element of other. |
|
This is an experimental API that is subject to change or deletion. |
|
Sorts the input tensor along the given dimension in specified order and return the sorted indices. |
|
This is an experimental optimizer API that is subject to change. |
|
Computes the equivalence between two tensors element-wise. |
|
None |
|
Computes the equivalence between two tensors. |
|
This is an experimental API that is subject to change or deletion. |
|
Compare the value of the input parameters \(input > other\) element-wise, and the output result is a bool value. |
|
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 |
|
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 -inf for each position. |
|
This is an experimental API that is subject to change. This API can be used only on the Atlas A2 training series. |
|
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 |
|
Computes the non-equivalence of two tensors element-wise. |
|
None |
|
Alias for |
|
None |
|
Finds values and indices of the k largest or smallest entries along a given dimension. |
|
If sorted is set to False, due to different memory layout and traversal methods on different platforms, the display order of calculation results may be inconsistent when sorted is False. |
|
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. |
BLAS and LAPACK Operations
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. |
|
This is an experimental API that is subject to change or deletion. |
|
Performs a matrix multiplication of the 2-D matrices mat1 and mat2. |
|
This is an experimental API that is subject to change or deletion. |
|
The result is the sum of the input and a batch matrix-matrix product of matrices in batch1 and batch2. |
|
None |
|
Performs batch matrix-matrix multiplication of two three-dimensional tensors. |
|
None |
|
Computes the dot product of two 1D tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Compute the inverse of the input matrix. |
|
None |
|
Returns the matrix product of two tensors. |
|
None |
|
Generates coordinate matrices from given coordinate tensors. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns the matrix product of two arrays. |
|
This is an experimental API that is subject to change or deletion. |
|
Return outer product of input and vec2. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns a new tensor that is the sum of the input main trace. |
|
None |
Other Operations
API Name |
Description |
Supported Platforms |
Warning |
Broadcasts input tensor to a given shape. |
|
None |
|
Computes p-norm distance between each pair of row vectors of two input Tensors. |
|
This is an experimental optimizer API that is subject to change. |
|
Returns a tuple (values, indices) where values is the cumulative maximum value of input Tensor input along the dimension dim, 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 dim, and indices is the index location of each minimum value. |
|
None |
|
Computes the cumulative sum of input Tensor along dim. |
|
None |
|
If input is a vector (1-D tensor), then returns a 2-D square tensor with the elements of input as the diagonal. |
|
This is an experimental API that is subject to change or deletion. |
|
Flatten a tensor along dimensions from start_dim to end_dim. |
|
None |
|
Reverses the order of elements in a tensor along the given axis. |
|
None |
|
Repeat elements of a tensor along an axis, like |
|
Only support on Atlas A2 training series. |
|
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 |
|
Returns the lower triangle part of input (elements that contain the diagonal and below), and set the other elements to zeros. |
|
None |
|
Solves a system of equations with a square upper or lower triangular invertible matrix A and multiple right-hand sides b. |
|
This is an experimental API that is subject to change or deletion. |
mindspore.mint.nn
Loss Functions
API Name |
Description |
Supported Platforms |
Warning |
L1Loss is used to calculate the mean absolute error between the predicted value and the target value. |
|
None |
Convolution Layers
API Name |
Description |
Supported Platforms |
Warning |
2D convolution layer. |
|
None |
|
3D convolution layer. |
|
This is an experimental API that is subject to change or deletion. |
|
Applies a 2D transposed convolution operator over an input image composed of several input planes. |
|
This is an experimental API that is subject to change or deletion. In the scenario where inputs are non-contiguous, output_padding must be less than stride . For Atlas training products, when the dtype of input is float32, the groups only supports 1. |
|
Combines an array of sliding local blocks into a large containing tensor. |
|
None |
|
Extracts sliding local blocks from a batched input tensor. |
|
None |
Normalization Layers
API Name |
Description |
Supported Platforms |
Warning |
Applies Batch Normalization over a 2D or 3D input as described in the paper Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift . |
|
This API does not support Dynamic Rank. This is an experimental API that is subject to change or deletion. |
|
Applies Batch Normalization over a 4D input as described in the paper Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift . |
|
This API does not support Dynamic Rank. This is an experimental API that is subject to change or deletion. |
|
Applies Batch Normalization over a 5D input as described in the paper Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift . |
|
This API does not support Dynamic Rank. This is an experimental API that is subject to change or deletion. |
|
Group Normalization over a mini-batch of inputs. |
|
None |
|
Applies Layer Normalization over a mini-batch of inputs. |
|
This is an experimental API that is subject to change or deletion. |
|
Sync Batch Normalization layer over a N-dimension input. |
|
This is an experimental API that is subject to change or deletion. |
Non-linear Activations (weighted sum, nonlinearity)
API Name |
Description |
Supported Platforms |
Warning |
Exponential Linear Unit activation function |
|
This is an experimental API that is subject to change or deletion. |
|
Activation function GELU (Gaussian Error Linear Unit). |
|
None |
|
Applies Hard Shrink activation function element-wise. |
|
None |
|
Applies Hard Sigmoid activation function element-wise. |
|
None |
|
Applies Hard Swish activation function element-wise. |
|
None |
|
Applies logsigmoid activation element-wise. |
|
This is an experimental API that is subject to change or deletion. |
|
Applies the Log Softmax function to the input tensor on the specified axis. |
|
None |
|
Computes MISH (A Self Regularized Non-Monotonic Neural Activation Function) of input tensors element-wise. |
|
None |
|
Applies PReLU activation function element-wise. |
|
None |
|
Applies ReLU (Rectified Linear Unit activation function) element-wise. |
|
None |
|
Activation function ReLU6. |
|
This is an experimental API that is subject to change or deletion. |
|
Activation function SELU (Scaled exponential Linear Unit). |
|
None |
|
Calculates the SiLU activation function element-wise. |
|
This is an experimental API that is subject to change or deletion. |
|
Applies the Softmax function to an n-dimensional input Tensor. |
|
None |
|
Applies the Softshrink function element-wise. |
|
None |
|
Applies the Tanh function element-wise, returns a new tensor with the hyperbolic tangent of the elements of input. |
|
This is an experimental API that is subject to change or deletion. |
Embedding Layers
API Name |
Description |
Supported Platforms |
Warning |
The value in input is used as the index, and the corresponding embedding vector is queried from weight . |
|
This is an experimental API that is subject to change or deletion. On Ascend, the behavior is unpredictable when the value of input is invalid. |
Linear Layers
API Name |
Description |
Supported Platforms |
Warning |
The linear connected layer. |
|
On the Ascend platform, if bias is |
Dropout Layers
API Name |
Description |
Supported Platforms |
Warning |
Dropout layer for the input. |
|
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\)). |
|
This is an experimental API that is subject to change or deletion. |
Pooling Layers
API Name |
Description |
Supported Platforms |
Warning |
Applies a 1D adaptive average pooling over an input signal composed of several input planes. |
|
This is an experimental API that is subject to change or deletion. |
|
Applies a 2D adaptive average pooling over an input signal composed of several input planes. |
|
This is an experimental API that is subject to change or deletion. |
|
This operator applies a 3D adaptive average pooling to an input signal composed of multiple input planes. |
|
For Ascend, it is only supported on Atlas A2 Training Series Products. This is an experimental optimizer API that is subject to change or deletion. |
|
Applies a 1D adaptive max pooling over an input signal composed of several input planes. |
|
This is an experimental API that is subject to change or deletion. |
|
Applies a 2D average pooling over an input Tensor which can be regarded as a composition of 2D input planes. |
|
None |
|
Applies a 3D average pooling over an input Tensor which can be regarded as a composition of 3D input planes. |
|
This is an experimental API that is subject to change or deletion. |
|
Computes the inverse of Maxpool2d. |
|
This is an experimental API that is subject to change or deletion. |
Padding Layers
API Name |
Description |
Supported Platforms |
Warning |
Pad the last dimension of input tensor using padding and value. |
|
This is an experimental API that is subject to change or deletion. |
|
Pad the last 2 dimensions of input tensor using padding and value. |
|
This is an experimental API that is subject to change or deletion. |
|
Pad the last 3 dimension of input tensor using padding and value. |
|
This is an experimental API that is subject to change or deletion. |
|
Pad the last dimension of input tensor using the reflection of the input boundary. |
|
This is an experimental API that is subject to change or deletion. |
|
Pad the last 2 dimension of input tensor using the reflection of the input boundary. |
|
This is an experimental API that is subject to change or deletion. |
|
Pad the last 3 dimension of input tensor using the reflection of the input boundary. |
|
This is an experimental API that is subject to change or deletion. |
|
Pad the last dimension of input tensor using the replication of the input boundary. |
|
This is an experimental API that is subject to change or deletion. |
|
Pad the last 2 dimension of input tensor using the replication of the input boundary. |
|
This is an experimental API that is subject to change or deletion. |
|
Pad the last 3 dimension of input tensor using the replication of the input boundary. |
|
This is an experimental API that is subject to change or deletion. |
|
Pad the last dimension of input tensor with 0 using padding. |
|
This is an experimental API that is subject to change or deletion. |
|
Pad the last 2 dimension of input tensor with 0 using padding. |
|
This is an experimental API that is subject to change or deletion. |
|
Pad the last 3 dimension of input tensor with 0 using padding. |
|
This is an experimental API that is subject to change or deletion. |
Loss Functions
API Name |
Description |
Supported Platforms |
Warning |
Compute the binary cross entropy between the true labels and predicted labels. |
|
This is an experimental API that is subject to change or deletion. |
|
Adds sigmoid activation function to input as logits, and uses this logits to compute binary cross entropy between the logits and the target. |
|
None |
|
The cross entropy loss between input and target. |
|
This is an experimental API that is subject to change or deletion. |
|
Calculates the mean squared error between the predicted value and the label value. |
|
None |
|
Gets the negative log likelihood loss between inputs and target. |
|
This is an experimental API that is subject to change or deletion. |
|
Computes smooth L1 loss, a robust L1 loss. |
|
This is an experimental API that is subject to change or deletion. |
Image Processing Layer
API Name |
Description |
Supported Platforms |
Warning |
For details, please refer to |
|
This is an experimental API that is subject to change or deletion. |
Tools
API Name |
Description |
Supported Platforms |
Warning |
A placeholder identity operator that returns the same as input. |
|
None |
mindspore.mint.nn.functional
Convolution functions
API Name |
Description |
Supported Platforms |
Warning |
Applies a 2D convolution over an input tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Applies a 3D convolution over an input tensor. |
|
This API does not support Atlas series products. This is an experimental API that is subject to change or deletion. |
|
Applies a 2D transposed convolution operator over an input image composed of several input planes, sometimes also called deconvolution (although it is not an actual deconvolution). |
|
This is an experimental API that is subject to change or deletion. In the scenario where inputs are non-contiguous, output_padding must be less than stride . For Atlas training products, when the dtype of input is float32, the groups only supports 1. |
|
Combines an array of sliding local blocks into a large containing tensor. |
|
Currently, only unbatched(3D) or batched(4D) image-like output tensors are supported. |
|
Extracts sliding local blocks from a batched input tensor. |
|
Currently, batched(4D) image-like tensors are supported. For Ascend, it is only supported on platforms above Atlas A2. |
Pooling functions
API Name |
Description |
Supported Platforms |
Warning |
Performs 1D adaptive average pooling on a multi-plane input signal. |
|
This is an experimental API that is subject to change or deletion. |
|
Performs 2D adaptive average pooling on a multi-plane input signal. |
|
This is an experimental API that is subject to change or deletion. |
|
Performs 1D adaptive max pooling on a multi-plane input signal. |
|
This is an experimental API that is subject to change or deletion. |
|
Applies a 1D average pooling over an input Tensor which can be regarded as a composition of 1D input planes. |
|
This is an experimental API that is subject to change or deletion. |
|
Applies a 2D average pooling over an input Tensor which can be regarded as a composition of 2D input planes. |
|
None |
|
Applies a 3D average pooling over an input Tensor which can be regarded as a composition of 3D input planes. |
|
This is an experimental API that is subject to change or deletion. |
|
Performs a 2D max pooling on the input Tensor. |
|
Only support on Atlas A2 training series. |
|
Computes the inverse of max_pool2d. |
|
This is an experimental API that is subject to change or deletion. |
Non-linear activation functions
API Name |
Description |
Supported Platforms |
Warning |
Batch Normalization for input data and updated parameters. |
|
None |
|
Exponential Linear Unit activation function |
|
This is an experimental API that is subject to change or deletion. |
|
Exponential Linear Unit activation function |
|
This is an experimental API that is subject to change or deletion. |
|
Gaussian Error Linear Units activation function. |
|
None |
|
Group Normalization over a mini-batch of inputs. |
|
None |
|
Hard Shrink activation function. |
|
None |
|
Hard Sigmoid activation function. |
|
None |
|
Hard Swish activation function. |
|
None |
|
Applies the Layer Normalization on the mini-batch input. |
|
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. |
|
This is an experimental API that is subject to change or deletion. |
|
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. |
|
This is an experimental optimizer API that is subject to change. |
|
ReLuComputes ReLU (Rectified Linear Unit activation function) inplace of input tensors element-wise. |
|
This is an experimental API that is subject to change or deletion. |
|
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 softplus function to input element-wise. |
|
None |
|
Soft Shrink activation function. |
|
None |
|
Computes hyperbolic tangent of input element-wise. |
|
None |
Normalization functions
API Name |
Description |
Supported Platforms |
Warning |
Perform normalization of inputs over specified dimension |
|
This is an experimental API that is subject to change or deletion. |
Linear functions
API Name |
Description |
Supported Platforms |
Warning |
Applies the dense connected operation to the input. |
|
This is an experimental API that is subject to change or deletion. On the Ascend platform, if bias is not 1D, the input cannot be greater than 6D in PYNATIVE or KBK mode. |
Dropout functions
API Name |
Description |
Supported Platforms |
Warning |
During training, randomly zeroes some of the elements of the input tensor with probability p from a Bernoulli distribution. |
|
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\)). |
|
This is an experimental API that is subject to change or deletion. |
Sparse functions
API Name |
Description |
Supported Platforms |
Warning |
Retrieve the word embeddings in weight using indices specified in input. |
|
On Ascend, the behavior is unpredictable when the value of input is invalid. |
|
Computes a one-hot tensor. |
|
None |
Loss Functions
API Name |
Description |
Supported Platforms |
Warning |
Computes the binary cross entropy(Measure the difference information between two probability distributions) between predictive value input and target value target. |
|
The value of input must range from 0 to l. |
|
|
Adds sigmoid activation function to input as logits, and uses this logits to compute binary cross entropy between the logits and the target. |
|
None |
Calculate the mean absolute error between the input value and the target value. |
|
None |
|
Calculates the mean squared error between the predicted value and the label value. |
|
None |
|
Gets the negative log likelihood loss between input and target. |
|
This is an experimental API that is subject to change or deletion. |
|
Computes smooth L1 loss, a robust L1 loss. |
|
This is an experimental optimizer API that is subject to change. |
Vision functions
API Name |
Description |
Supported Platforms |
Warning |
Samples the input Tensor to the given size or scale_factor by using one of the interpolate algorithms. |
|
This is an experimental API that is subject to change or deletion. |
|
Given an input and a flow-field grid, computes the output using input values and pixel locations from grid. |
|
None |
|
Pads the input tensor according to the pad. |
|
circular mode has poor performance and is not recommended. |
mindspore.mint.optim
API Name |
Description |
Supported Platforms |
Warning |
Implements Adaptive Moment Estimation (Adam) algorithm. |
|
This is an experimental API that is subject to change or deletion. |
|
Implements Adam Weight Decay algorithm. |
|
This is an experimental optimizer API that is subject to change. This module must be used with lr scheduler module in LRScheduler Class . For Ascend, it is only supported on platforms above Atlas A2. |
mindspore.mint.linalg
Inverses
API Name |
Description |
Supported Platforms |
Warning |
Compute the inverse of the input matrix. |
|
None |
|
Returns the matrix norm of a given tensor on the specified dimensions. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns the matrix norm or vector norm of a given tensor. |
|
This is an experimental API that is subject to change or deletion. |
|
Returns the vector norm of the given tensor on the specified dimensions. |
|
This is an experimental API that is subject to change or deletion. |
|
Orthogonal decomposition of the input \(A = QR\). |
|
This is an experimental API that is subject to change or deletion. |
mindspore.mint.special
Pointwise Operations
API Name |
Description |
Supported Platforms |
Warning |
Computes the complementary error function of input element-wise. |
|
None |
|
Calculates the base-2 exponent of the Tensor input element by element. |
|
None |
|
Returns exponential then minus 1 of a tensor element-wise. |
|
None |
|
Returns the natural logarithm of one plus the input tensor element-wise. |
|
None |
|
Applies the Log Softmax function to the input tensor on the specified axis. |
|
None |
|
Returns half to even of a tensor element-wise. |
|
None |
|
Computes the normalized sinc of input. |
|
None |
mindspore.mint.distributed
API Name |
Description |
Supported Platforms |
Warning |
Gathers tensors from the specified communication group and returns the tensor list which is all gathered. |
|
None |
|
Gathers tensors from the specified communication group and returns the tensor which is all gathered. |
|
None |
|
Aggregates Python objects in a specified communication group. |
|
None |
|
Reduce tensors across all devices in such a way that all deviceswill get the same final result, returns the tensor which is all reduced. |
|
None |
|
scatter and gather list of tensor to/from all rank according to input/output tensor list. |
|
None |
|
scatter and gather input with split size to/from all rank, and return result in a single tensor. |
|
None |
|
Synchronizes all processes in the specified group. |
|
None |
|
Batch send and recv tensors asynchronously. |
|
None |
|
Broadcasts the tensor to the whole group. |
|
None |
|
Broadcasts the entire group of input Python objects. |
|
None |
|
Destroy the user collective communication group. |
|
None |
|
Gathers tensors from the specified communication group. |
|
None |
|
Gathers python objects from the whole group in a single process. |
|
None |
|
Get the backend of communication process groups. |
|
None |
|
A function that returns the rank id in the world group corresponding to the rank which id is 'group_rank' in the user group. |
|
None |
|
Get the rank ID in the specified user communication group corresponding to the rank ID in the world communication group. |
|
None |
|
Gets the ranks of the specific group and returns the process ranks in the communication group as a list. |
|
None |
|
Get the rank ID for the current device in the specified collective communication group. |
|
None |
|
Get the rank size of the specified collective communication group. |
|
None |
|
Init collective communication lib. |
|
None |
|
Receive tensors from src asynchronously. |
|
None |
|
Send tensors to the specified dest_rank asynchronously. |
|
None |
|
Checks if distributed module is available. |
|
None |
|
Checks if default process group has been initialized. |
|
None |
|
Create a new distributed group. |
|
None |
|
Object for batch_isend_irecv input, to store information of |
|
None |
|
Receive tensors from src. |
|
None |
|
Reduces tensors across the processes in the specified communication group, sends the result to the target dst(global rank), and returns the tensor which is sent to the target process. |
|
None |
|
Reduces and scatters tensors from the specified communication group and returns the tensor which is reduced and scattered. |
|
None |
|
Reduces and scatters tensors from the specified communication group and returns the tensor which is reduced and scattered. |
|
None |
|
Scatter tensor evently across the processes in the specified communication group. |
|
None |
|
Scatters picklable objects in scatter_object_input_list to the whole group. |
|
None |
|
Send tensors to the specified dest_rank. |
|
None |