mindspore.ops.primitive
operators that can be used for constructor function of Cell
For more information about dynamic shape support status, please refer to Dynamic Shape Support Status of primitive Interface .
For more information about the support for the bfloat16 data type, please refer to Support List .
For the details about the usage constraints of each operator in the operator parallel process, refer to Usage Constraints During Operator Parallel .
The module import method is as follows:
import mindspore.ops as ops
Compared with the previous version, the added, deleted and supported platforms change information of mindspore.ops.primitive operators in MindSpore, please refer to the link mindspore.ops.primitive API Interface Change .
Operator Primitives
Primitive is the base class of operator primitives in python. |
|
PrimitiveWithCheck is the base class of primitives in python, which defines functions to check the input arguments of operators, but uses the infer method registered in c++ source codes. |
|
PrimitiveWithInfer is the base class of primitives in python and defines functions for tracking inference in python. |
Neural Network Layer Operators
Neural Network
API Name |
Description |
Supported Platforms |
Average pooling operation. |
|
|
3D Average pooling operation. |
|
|
Batch Normalization for input data and updated parameters. |
|
|
2D convolution layer. |
|
|
Calculates a 2D transposed convolution, which can be regarded as Conv2d for the gradient of the input, also called deconvolution, although it is not an actual deconvolution. |
|
|
3D convolution layer. |
|
|
Computes a 3D transposed convolution, which is also known as a deconvolution (although it is not an actual deconvolution). |
|
|
Performs greedy decoding on the logits given in inputs. |
|
|
Refer to |
|
|
During training, randomly zeroes some of the elements of the input tensor with probability \(1 - keep\_prob\) from a Bernoulli distribution. |
|
|
During training, randomly zeroes some channels of the input tensor with probability \(1-keep\_prob\) from a Bernoulli distribution(For a 4-dimensional tensor with a shape of \((N, C, H, W)\), the channel feature map refers to a 2-dimensional feature map with the shape of \((H, W)\)). |
|
|
During training, randomly zeroes some channels of the input tensor with probability \(1-keep\_prob\) 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). |
|
|
Applies a single-layer gated recurrent unit (GRU) to an input sequence. |
|
|
Applies a recurrent neural network to the input. |
|
|
Flattens a tensor without changing its batch size on the 0-th axis. |
|
|
Applies a 3D fractional max pooling to an input signal composed of multiple input planes. |
|
|
This operation samples 2d input_x by using interpolation based on flow field grid, which is usually gennerated by |
|
|
Given an input and a grid, the output is calculated using the input values and pixel positions in the grid. |
|
|
Applies the Layer Normalization to the input tensor. |
|
|
Local Response Normalization. |
|
|
Performs the Long Short-Term Memory (LSTM) on the input. |
|
|
Max pooling operation. |
|
|
Applies a 3D max pooling over an input Tensor which can be regarded as a composition of 3D planes. |
|
|
Performs a 3D max pooling on the input Tensor and returns both max values and indices. |
|
|
Calculates the partial inverse of MaxPool2D operation. |
|
|
Computes the inverse of |
|
|
Pads the input tensor according to the paddings and mode. |
|
|
Pads the input tensor according to the paddings. |
|
|
Returns a slice of input tensor based on the specified indices. |
|
|
Extends the last dimension of the input tensor from 1 to pad_dim_size, by filling with 0. |
|
|
Resize images to size using bicubic interpolation. |
|
|
Resizes the input tensor to a given size by using the nearest neighbor algorithm. |
|
Loss Function
API Name |
Description |
Supported Platforms |
Adds sigmoid activation function to input as logits, and uses the given logits to compute binary cross entropy between the logits and the target. |
|
|
Computes the binary cross entropy between the logits and the labels. |
|
|
Calculates the CTC (Connectionist Temporal Classification) loss and the gradient. |
|
|
Calculates the CTC (Connectionist Temporal Classification) loss and the gradient. |
|
|
Computes the Kullback-Leibler divergence between the logits and the labels. |
|
|
Calculates half of the L2 norm, but do not square the result. |
|
|
Creates a loss criterion that minimizes the hinge loss for multi-class classification tasks. |
|
|
Creates a loss function that minimizes the hinge loss for multi-class classification tasks. |
|
|
Gets the negative log likelihood loss between logits and labels. |
|
|
Computes the RNNTLoss and its gradient with respect to the softmax outputs. |
|
|
Uses the given logits to compute sigmoid cross entropy between the logits and the label. |
|
|
Calculate the smooth L1 loss, and the L1 loss function has robustness. |
|
|
Refer to |
|
|
Gets the softmax cross-entropy value between logits and labels with one-hot encoding. |
|
|
Computes the softmax cross-entropy value between logits and sparse encoding labels. |
|
|
TripletMarginLoss operation. |
|
Activation Function
API Name |
Description |
Supported Platforms |
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Gaussian Error Linear Units activation function. |
|
|
Computes GLU (Gated Linear Unit activation function) of the input tensor. |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Computes MISH(A Self Regularized Non-Monotonic Neural Activation Function) of input tensors element-wise. |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Activation function SeLU (Scaled exponential Linear Unit). |
|
|
Refer to |
|
|
Applies the Softmax operation to the input tensor on the specified axis. |
|
|
Softplus activation function. |
|
|
Refer to |
|
|
Softsign activation function. |
|
|
Refer to |
|
Optimizer
API Name |
Description |
Supported Platforms |
Updates gradients by the Adaptive Moment Estimation (Adam) algorithm. |
|
|
Updates gradients by the Adaptive Moment Estimation algorithm with weight decay (AdamWeightDecay). |
|
|
AdaptiveAvgPool2D operation. |
|
|
AdaptiveAvgPool3D operation. |
|
|
Updates relevant entries according to the adadelta scheme. |
|
|
Updates relevant entries according to the adagrad scheme. |
|
|
Update var according to the proximal adagrad scheme. |
|
|
Updates relevant entries according to the adagradv2 scheme. |
|
|
Updates relevant entries according to the adamax scheme. |
|
|
Update var according to the Adam algorithm. |
|
|
Updates relevant entries according to the AddSign algorithm. |
|
|
Optimizer that implements the centered RMSProp algorithm. |
|
|
Updates relevant entries according to the FTRL scheme. |
|
|
Updates var by subtracting alpha * delta from it. |
|
|
Optimizer that implements the Momentum algorithm. |
|
|
Updates relevant entries according to the AddSign algorithm. |
|
|
Updates relevant entries according to the proximal adagrad algorithm. |
|
|
Updates relevant entries according to the FOBOS(Forward Backward Splitting) algorithm. |
|
|
Optimizer that implements the Root Mean Square prop(RMSProp) algorithm. |
|
|
Conducts LARS (layer-wise adaptive rate scaling) update on the sum of squares of gradient. |
|
|
Updates relevant entries according to the adagrad scheme, one more epsilon attribute than SparseApplyAdagrad. |
|
|
Updates relevant entries according to the proximal adagrad algorithm. |
|
|
Computes the stochastic gradient descent. |
|
|
Updates relevant entries according to the FTRL-proximal scheme For more details, please refer to |
|
|
The SparseApplyFtrlV2 interface is deprecated, please use the |
Deprecated |
Distance Function
API Name |
Description |
Supported Platforms |
Refer to |
|
|
Computes the Levenshtein Edit Distance. |
|
|
Return the p-norm of a matrix or vector. |
|
|
Computes the p-norm distance between each pair of row vectors in the input. |
|
Sampling Operator
API Name |
Description |
Supported Platforms |
Compute accidental hits of sampled classes which match target classes. |
|
|
Generates random labels with a log-uniform distribution for sampled_candidates. |
|
|
Uniform candidate sampler. |
|
Image Processing
API Name |
Description |
Supported Platforms |
Decodes bounding boxes locations. |
|
|
Encodes bounding boxes locations. |
|
|
Checks bounding box. |
|
|
Extracts crops from the input image tensor and resizes them. |
|
|
ops.ExtractVolumePatches is deprecated from version 2.3 and will be removed in a future version. |
Deprecated |
|
Calculates intersection over union for boxes. |
|
|
L2 Normalization Operator. |
|
|
Non-maximum Suppression. |
|
|
Resizes an image to a certain size using the bilinear interpolation. |
|
|
Computes the Region of Interest (RoI) Align operator. |
|
|
Performs nearest neighbor upsampling operation. |
|
|
Performs upsampling with trilinear interpolation across 3dims for 5dim input Tensor. |
|
Text Processing
API Name |
Description |
Supported Platforms |
Updates the probability of occurrence of words with its corresponding n-grams. |
|
Mathematical Operators
API Name |
Description |
Supported Platforms |
Counts the number of occurrences of each value in an integer array. |
|
|
Performs the Cholesky decomposition on a single or a batch of symmetric positive-definite matrices. |
|
|
Returns a complex Tensor from the real part and the imag part. |
|
|
Returns a Tensor that contains the magnitudes of the input. |
|
|
Returns the cross product of vectors in dimension dim of input and other. |
|
|
Fourier transform, can be adjusted by parameters to achieve FFT/IFFT/RFFT/IRFFT. |
|
|
Refer to |
|
Element-wise Operator
API Name |
Description |
Supported Platforms |
Refer to |
|
|
Computes accumulation of all input tensors element-wise. |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Adds the element-wise division of x1 by x2, multiplied by value to input_data. |
|
|
Adds the element-wise product of x1 by x2, multiplied by value to input_data. |
|
|
Computes addition of all input tensors element-wise. |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Computes modified Bessel function of the first kind, order 0 element-wise. |
|
|
Computes exponential scaled modified Bessel function of the first kind, order 0 element-wise. |
|
|
Computes modified Bessel function of the first kind, order 1 element-wise. |
|
|
Computes exponential scaled modified Bessel function of the first kind, order 1 element-wise. |
|
|
Computes Bessel function of the first kind, order 0 element-wise. |
|
|
Computes Bessel function of the first kind, order 1 element-wise. |
|
|
Computes modified Bessel function of the second kind, order 0 element-wise. |
|
|
Computes exponential scaled modified Bessel function of the second kind, order 0 element-wise. |
|
|
Computes modified Bessel function of the second kind, order 1 element-wise. |
|
|
Computes exponential scaled modified Bessel function of the second kind, order 1 element-wise. |
|
|
Computes Bessel function of the second kind, order 0 element-wise. |
|
|
Computes Bessel function of the second kind, order 1 element-wise. |
|
|
Returns bitwise and of two tensors element-wise. |
|
|
Returns bitwise or of two tensors element-wise. |
|
|
Returns bitwise xor of two tensors element-wise. |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Computes the grad of the lgamma function on input. |
|
|
Computes the quotient of dividing the first input tensor by the second input tensor element-wise. |
|
|
Operates a safe division between x1 and x2 element-wise. |
|
|
Sums the product of the elements of the input Tensor along dimensions specified notation based on the Einstein summation convention(Einsum). |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Returns a new tensor containing imaginary value of the input. |
|
|
Computes Reciprocal of input tensor element-wise. |
|
|
Flips all bits of input tensor element-wise. |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Computes the "logical AND" of two tensors element-wise. |
|
|
Computes the "logical NOT" of a tensor element-wise. |
|
|
Computes the "logical OR" of two tensors element-wise. |
|
|
Computes the "logical XOR" of two tensors element-wise. |
|
|
Calculate the logit of a tensor element-wise. |
|
|
Computes the remainder of dividing the first input tensor by the second input tensor element-wise. |
|
|
Refer to |
|
|
Computes x * y element-wise. |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Converts polar coordinates to Cartesian coordinates. |
|
|
Computes the \(a\). |
|
|
Refer to |
|
|
Divides the first input tensor by the second input tensor in floating-point type element-wise. |
|
|
Returns reciprocal of a tensor element-wise. |
|
|
Returns an integer that is closest to input_x element-wise. |
|
|
Returns half to even of a tensor element-wise. |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Subtracts the second input tensor from the first input tensor element-wise and returns square of it. |
|
|
Returns the square sum of a tensor element-wise. |
|
|
Subtracts the second input tensor from the first input tensor element-wise. |
|
|
Computes tangent of input element-wise. |
|
|
Refer to |
|
|
Divides the first input tensor by the second input tensor element-wise and rounds the results of division towards zero. |
|
|
Returns the remainder of division element-wise. |
|
|
Divides the first input tensor by the second input tensor element-wise. |
|
|
Computes the first input tensor multiplied by the logarithm of second input tensor element-wise. |
|
|
Compute the Hurwitz zeta function ζ(x,q) of input Tensor. |
|
Reduction Operator
API Name |
Description |
Supported Platforms |
Returns the indices of the maximum value along a specified axis of a Tensor. |
|
|
Calculates the maximum value along with the given axis for the input tensor, and returns the maximum values and indices. |
|
|
Returns the indices of the minimum value along a specified axis of a Tensor. |
|
|
Calculates the minimum value along with the given axis for the input tensor, and returns the minimum values and indices. |
|
|
Computes the median and its corresponding indices of input tensor in the axis dimension. |
|
|
Refer to |
|
|
Reduces a dimension of a tensor by the "logical OR" of all elements in the dimension, by default. |
|
|
Reduces a dimension of a tensor by the maximum value in this dimension, by default. |
|
|
Reduces a dimension of a tensor by averaging all elements in the dimension, by default. |
|
|
Reduces a dimension of a tensor by the minimum value in the dimension, by default. |
|
|
Reduces a dimension of a tensor by multiplying all elements in the dimension, by default. |
|
|
Reduces a dimension of a tensor by summing all elements in the dimension, by default. |
|
Comparison Operator
API Name |
Description |
Supported Platforms |
Returns |
|
|
Refer to |
|
|
Computes the number of the same elements of two tensors. |
|
|
Refer to |
|
|
Refer to |
|
|
Determines whether the targets are in the top k predictions. |
|
|
Refer to |
|
|
Refer to |
|
|
Determines which elements are NaN for each position. |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Finds values and indices of the k largest entries along the last dimension. |
|
Linear Algebraic Operator
API Name |
Description |
Supported Platforms |
Computes matrix multiplication between two tensors by batch. |
|
|
Returns the sum of the input Tensor and the bias Tensor. |
|
|
Ger product of x1 and x2. |
|
|
Multiplies matrix a and matrix b. |
|
|
Returns the inverse of the input matrix. |
|
|
Computes the matrix-matrix multiplication of a product of Householder matrices with a general matrix. |
|
|
Calculates the explicit representation of the orthogonal matrix \(Q\) returned by |
|
|
Computes the singular value decompositions of one or more matrices. |
|
Tensor Operation Operator
Tensor Construction
API Name |
Description |
Supported Platforms |
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. |
|
|
Returns a tensor with ones on the diagonal and zeros in the rest. |
|
|
The Fill interface is deprecated, please use the |
Deprecated |
|
Generate a one-dimensional tensor with steps elements, evenly distributed in the interval [start, end]. |
|
|
Computes a one-hot tensor. |
|
|
Creates a tensor filled with value ones. |
|
|
Returns a Tensor with a value of 1 and its shape and data type is the same as the input. |
|
|
Zeros will be deprecated in the future. |
|
|
Returns a Tensor with a value of 0 and its shape and data type is the same as the input. |
|
Random Generation Operator
API Name |
Description |
Supported Platforms |
Randomly set the elements of output to 0 or 1 with the probability of P which follows the Bernoulli distribution. |
|
|
Produces random positive floating-point values x, distributed according to probability density function: |
|
|
Returns a tensor sampled from the multinomial probability distribution located in the corresponding row of tensor input. |
|
|
Returns a tensor where each row contains numsamples indices sampled from the multinomial distribution with replacement. |
|
|
Generates random samples from a given categorical distribution tensor. |
|
|
Generates a random sample as index tensor with a mask tensor from a given tensor. |
|
|
Produces random positive floating-point values x, distributed according to probability density function: |
|
|
Produces random non-negative values i, distributed according to discrete probability function: |
|
|
Generates n random samples from 0 to n-1 without repeating. |
|
|
Refer to |
|
|
Generates random numbers according to the Laplace random number distribution (mean=0, lambda=1). |
|
|
Generates random numbers according to the standard Normal (or Gaussian) random number distribution. |
|
|
Produces random integer values i, uniformly distributed on the closed interval [minval, maxval), that is, distributed according to the discrete probability function: |
|
|
Produces random floating-point values, uniformly distributed to the interval [0, 1). |
|
Array Operation
API Name |
Description |
Supported Platforms |
Creates a 2D or 3D flow field (sampling grid) based on a batch of affine matrices theta. |
|
|
Divides batch dimension with blocks and interleaves these blocks back into spatial dimensions. |
|
|
Please use batch_to_space_nd instead. |
Deprecated |
|
Refer to |
|
|
Returns a tensor with the new specified data type. |
|
|
Divide the channels in a tensor of shape \((*, C, H, W)\) into \(g\) group and rearrange them as \((*, \frac{C}{g}, g, H*W)\), while retaining the original tensor shape in the final output. |
|
|
Rearranges a row vector to an image. |
|
|
Refer to |
|
|
Refer to |
|
|
Returns the cumulative minimum of elements and the index. |
|
|
Computes the cumulative product of the tensor x along axis. |
|
|
Computes the cumulative sum of input tensor along axis. |
|
|
Returns the dimension index in the destination data format given in the source data format. |
|
|
Rearrange blocks of depth data into spatial dimensions. |
|
|
Refer to |
|
|
Returns the data type of the input tensor as mindspore.dtype. |
|
|
Refer to |
|
|
Fills the main diagonal of a Tensor in-place with a specified value and returns the result. |
|
|
Creates a tensor with shape described by shape and fills it with values in value . |
|
|
Determines if the elements contain Not a Number(NaN), infinite or negative infinite. |
|
|
Computes the maximum of input tensors element-wise. |
|
|
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Computes the hamming window function with input window length. |
|
|
Applies the Heaviside step function for input x element-wise. |
|
|
Returns a rank 1 histogram counting the number of entries in values that fall into every bin. |
|
|
Computes hypotenuse of input tensors element-wise as legs of a right triangle. |
|
|
Refer to |
|
|
Calculates lower regularized incomplete Gamma function. |
|
|
Compute the upper regularized incomplete Gamma function Q(a, x). |
|
|
Extracts sliding local blocks from a batched input tensor. |
|
|
Adds tensor y to specified axis and indices of tensor x. |
|
|
Fills the elements under the dim dimension of the input Tensor x with the input value by selecting the indices in the order given in index. |
|
|
According to the index number of indexes, replace the value corresponding to x1 with the value in x2. |
|
|
Adds v into specified rows of x. |
|
|
Adds Tensor updates to specified axis and indices of Tensor var element-wise. |
|
|
Subtracts v into specified rows of x. |
|
|
Please use |
Deprecated |
|
Updates specified values in x to v according to indices. |
|
|
Computes the inverse of an index permutation. |
|
|
Returns a tensor of Boolean values indicating whether each element of input is "close" to the corresponding element of other. |
|
|
Computes least common multiplier of input tensors element-wise. |
|
|
Shift the value of each position of the tensor to the left several bits. |
|
|
Generates a 1-D Tensor with a length of steps. |
|
|
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. |
|
|
Refer to |
|
|
Updates the value in the input with value in updates according to the mask. |
|
|
Refer to |
|
|
Extracts the central diagonal band of each matrix in a tensor, with all values outside the central band set to zero. |
|
|
Returns the diagonal part of a tensor. |
|
|
Constructs a diagonal matrix or a batch of diagonal matrices from a given input Tensor. |
|
|
Updates the diagonal part of a batched tensor. |
|
|
Solves systems of linear equations. |
|
|
Generates coordinate matrices from given coordinate tensors. |
|
|
Calculates the multivariate log-gamma function element-wise for a given dimension p. |
|
|
Refer to |
|
|
Return a Tensor of the positions of all non-zero values. |
|
|
Concats input tensors along the first dimension. |
|
|
Computes element-wise population count(a.k.a bitsum, bitcount). |
|
|
Randomly shuffles a Tensor along its first dimension. |
|
|
Refer to |
|
|
Returns the rank of a tensor. |
|
|
Renormalizes the sub-tensors along dimension dim, and each sub-tensor's p-norm should not exceed the 'maxnorm'. |
|
|
Refer to |
|
|
Reverses variable length slices. |
|
|
Refer to |
|
|
Shift the value of each position of Tensor input_x to the right by corresponding bits in Tensor input_y. |
|
|
Refer to |
|
|
Applies sparse division to individual values or slices in a tensor. |
|
|
Computes sparse maximum to individual values or slices in a tensor. |
|
|
Applies sparse minimum to individual values or slices in a tensor. |
|
|
Applies sparse multiplication to individual values or slices in a tensor. |
|
|
Return the position indices where the elements can be inserted into the input tensor to maintain the increasing order of the input tensor. |
|
|
Refer to |
|
|
Returns the shape of the input tensor. |
|
|
Returns a Scalar of type int that represents the size of the input Tensor and the total number of elements in the Tensor. |
|
|
Slices a tensor in the specified shape. |
|
|
Sorts the elements of the input tensor along the given dimension in the specified order. |
|
|
Divides spatial dimensions into blocks and combines the block size with the original batch. |
|
|
Rearrange blocks of spatial data into depth. |
|
|
Returns a slice of input tensor based on the specified indices and axis. |
|
|
Splits the input tensor into output_num of tensors along the given axis and output numbers. |
|
|
Return the Tensor after deleting the dimension of size 1 in the specified axis. |
|
|
Stacks a list of tensors in specified axis. |
|
|
Refer to |
|
|
Creates a new tensor by adding the values from the positions in input_x indicated by indices, with values from updates. |
|
|
Creates a new tensor by dividing the values from the positions in input_x indicated by indices, with values from updates. |
|
|
By comparing the value at the position indicated by indices in 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. |
|
|
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. |
|
|
Creates a new tensor by multiplying the values from the positions in input_x indicated by indices, with values from updates. |
|
|
Creates a new tensor by subtracting the values from the positions in input_x indicated by indices, with values from updates. |
|
|
Creates a new tensor by updating the positions in input_x indicated by indices, with values from update. |
|
|
Returns the shape of the input tensor. |
|
|
Replicates an input tensor with given multiple times. |
|
|
Refer to |
|
|
Refer to |
|
|
Returns the lower triangular portion of the 2-D matrix or the set of matrices in a batch. |
|
|
Computes the indices of the lower triangular elements of a 2D matrix and returns them as a Tensor. |
|
|
Refer to |
|
|
Calculates the indices of the upper triangular elements in a row * col matrix and returns them as a 2-by-N Tensor. |
|
|
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. |
|
|
Returns the elements that are unique in each consecutive group of equivalent elements in the input tensor. |
|
|
'ops.UniqueWithPad' is deprecated from version 2.4 and will be removed in a future version. |
Deprecated |
|
Computes the maximum along segments of a tensor. |
|
|
Computes the minimum of a tensor along segments. |
|
|
Computes the product of a tensor along segments. |
|
|
Refer to |
|
|
Unstacks tensor in specified axis, this is the opposite of ops.Stack. |
|
Type Conversion
API Name |
Description |
Supported Platforms |
'ops.ScalarCast' is deprecated from version 2.3 and will be removed in a future version, please use int(x) or float(x) instead. |
Deprecated |
|
Converts a scalar to a Tensor, and converts the data type to the specified type. |
|
|
Converts a tuple to a tensor. |
|
Parameter Operation Operator
API Name |
Description |
Supported Platforms |
Refer to |
|
|
Refer to |
|
|
Refer to |
|
|
Updates the value of the input tensor through the addition operation. |
|
|
Updates the value of the input tensor through the divide operation. |
|
|
Updates the value of the input tensor through the maximum operation. |
|
|
Updates the value of the input tensor through the minimum operation. |
|
|
Updates the value of the input tensor through the multiply operation. |
|
|
Applies sparse addition to individual values or slices in a tensor. |
|
|
Applies sparse subtraction to individual values or slices in a tensor. |
|
|
Updates tensor values by using input indices and value. |
|
|
Please use TensorScatterAdd instead. |
Deprecated |
|
Updates the value of the input tensor through the subtraction operation. |
|
|
Updates tensor values by using input indices and value. |
|
Data Operation Operator
API Name |
Description |
Supported Platforms |
Returns the next element in the dataset queue. |
|
Communication Operator
Distributed training involves communication operations for data transfer. For more details, refer to Distributed Set Communication Primitives .
Note that the APIs in the following list need to preset communication environment variables. For Ascend/GPU/CPU devices, it is recommended to use the msrun startup method without any third-party or configuration file dependencies. Please see the msrun start up for more details.
API Name |
Description |
Supported Platforms |
Gathers tensors from the specified communication group and returns the tensor which is all gathered. |
|
|
Reduces tensors across all devices in such a way that all devices will get the same final result, returns the tensor which is all reduced. |
|
|
AlltoAll is a collective operation. |
|
|
AllToAllV which support uneven scatter and gather compared with AllToAll. |
|
|
Synchronizes all processes in the specified group. |
|
|
Broadcasts the tensor to the whole group. |
|
|
Gathers tensors from the specified communication group. |
|
|
Scatter input data evently across the processes in the specified communication group. |
|
|
NeighborExchangeV2 is a collective communication operation. |
|
|
Receive tensors from src_rank. |
|
|
Operation options for reducing tensors. |
|
|
Reduces and scatters tensors from the specified communication group and returns the tensor which is reduced and scattered. |
|
|
Reduces tensors across the processes in the specified communication group, sends the result to the target dest_rank(local rank), and returns the tensor which is sent to the target process. |
|
|
Send tensors to the specified dest_rank. |
|
Debugging Operator
API Name |
Description |
Supported Platforms |
This operator will calculate the histogram of a tensor and put it to a summary file with protocol buffer format. |
|
|
This operator will put an image tensor to a summary file with protocol buffer format. |
|
|
This operator will put a scalar to a summary file with protocol buffer format. |
|
|
This operator will put a tensor to a summary file with protocol buffer format. |
|
|
Save the Tensor as an npy file in numpy format. |
|
|
Print the inputs to stdout. |
|
|
Allocates a flag to store the overflow status. |
|
|
Clears the flag which stores the overflow status. |
|
|
|
|
Sparse Operator
API Name |
Description |
Supported Platforms |
Multiplies sparse matrix A by dense matrix B. |
|
|
Converts a sparse representation into a dense tensor. |
|
Frame Operators
API Name |
Description |
Supported Platforms |
Depend is used for processing dependency operations. |
|
|
Performs a loop operation within the specified range. |
|
|
A higher-order function which is used to generate the gradient function for the input function. |
|
|
This operation is used as a tag to hook gradient in intermediate variables. |
|
|
HyperMap will apply the set operation to input sequences. |
|
|
Attaches callback to the graph node that will be invoked on the node's gradient. |
|
|
The Morph Primitive is used to encapsulate a user-defined function fn, allowing it to be used as a custom Primitive. |
||
Map will apply the set operation on input sequences. |
|
|
MultitypeFuncGraph is a class used to generate overloaded functions, considering different types as inputs. |
|
|
Makes a partial function instance. |
|
|
Scan a function over an array while the processing of the current element depends on the execution result of the previous element. |
|
|
Provide a useful op for reducing compilation times of while loop. |
|
Operator Information Registration
Class for AiCPU operator information registration. |
|
Class used for generating the registration information for the func parameter of |
|
Various combinations of dtype and format of Ascend ops. |
|
Class for TBE operator information registration. |
|
Gets the virtual implementation function by a primitive object or primitive name. |
Customizing Operator
API Name |
Description |
Supported Platforms |
Custom primitive is used for user defined operators and is to enhance the expressive ability of built-in primitives. |
|
|
CustomOpBuilder is used to initialize and configure custom operators for MindSpore. |
|
|
A decorator which is used to bind the registration information to the func parameter of |
|
|
The decorator of the Hybrid DSL function for the Custom Op. |
|
Spectral Operator
API Name |
Description |
Supported Platforms |
Bartlett window function. |
|
|
Blackman window function. |
|