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

mindspore.ops.Primitive

Primitive is the base class of operator primitives in python.

mindspore.ops.PrimitiveWithCheck

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.

mindspore.ops.PrimitiveWithInfer

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

mindspore.ops.AvgPool

Average pooling operation.

Ascend GPU CPU

mindspore.ops.AvgPool3D

3D Average pooling operation.

Ascend GPU CPU

mindspore.ops.BatchNorm

Batch Normalization for input data and updated parameters.

Ascend GPU CPU

mindspore.ops.Conv2D

2D convolution layer.

Ascend GPU CPU

mindspore.ops.Conv2DTranspose

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.

Ascend GPU CPU

mindspore.ops.Conv3D

3D convolution layer.

Ascend GPU CPU

mindspore.ops.Conv3DTranspose

Computes a 3D transposed convolution, which is also known as a deconvolution (although it is not an actual deconvolution).

Ascend GPU CPU

mindspore.ops.CTCGreedyDecoder

Performs greedy decoding on the logits given in inputs.

Ascend GPU CPU

mindspore.ops.Dense

Refer to mindspore.ops.dense() for more details.

Ascend GPU CPU

mindspore.ops.Dropout

During training, randomly zeroes some of the elements of the input tensor with probability \(1 - keep\_prob\) from a Bernoulli distribution.

Ascend GPU CPU

mindspore.ops.Dropout2D

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)\)).

Ascend GPU CPU

mindspore.ops.Dropout3D

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).

Ascend GPU CPU

mindspore.ops.DynamicGRUV2

Applies a single-layer gated recurrent unit (GRU) to an input sequence.

Ascend

mindspore.ops.DynamicRNN

Applies a recurrent neural network to the input.

Ascend

mindspore.ops.Flatten

Flattens a tensor without changing its batch size on the 0-th axis.

Ascend GPU CPU

mindspore.ops.FractionalMaxPool3DWithFixedKsize

Applies a 3D fractional max pooling to an input signal composed of multiple input planes.

Ascend GPU CPU

mindspore.ops.GridSampler2D

This operation samples 2d input_x by using interpolation based on flow field grid, which is usually gennerated by mindspore.ops.affine_grid().

Ascend GPU CPU

mindspore.ops.GridSampler3D

Given an input and a grid, the output is calculated using the input values and pixel positions in the grid.

Ascend GPU CPU

mindspore.ops.LayerNorm

Applies the Layer Normalization to the input tensor.

Ascend GPU CPU

mindspore.ops.LRN

Local Response Normalization.

GPU CPU

mindspore.ops.LSTM

Performs the Long Short-Term Memory (LSTM) on the input.

GPU CPU

mindspore.ops.MaxPool

Max pooling operation.

Ascend GPU CPU

mindspore.ops.MaxPool3D

Applies a 3D max pooling over an input Tensor which can be regarded as a composition of 3D planes.

Ascend GPU CPU

mindspore.ops.MaxPool3DWithArgmax

Performs a 3D max pooling on the input Tensor and returns both max values and indices.

Ascend GPU CPU

mindspore.ops.MaxUnpool2D

Calculates the partial inverse of MaxPool2D operation.

Ascend GPU CPU

mindspore.ops.MaxUnpool3D

Computes the inverse of mindspore.ops.MaxPool3D.

Ascend GPU CPU

mindspore.ops.MirrorPad

Pads the input tensor according to the paddings and mode.

Ascend GPU CPU

mindspore.ops.Pad

Pads the input tensor according to the paddings.

Ascend GPU CPU

mindspore.ops.EmbeddingLookup

Returns a slice of input tensor based on the specified indices.

Ascend GPU CPU

mindspore.ops.Padding

Extends the last dimension of the input tensor from 1 to pad_dim_size, by filling with 0.

Ascend GPU CPU

mindspore.ops.ResizeBicubic

Resize images to size using bicubic interpolation.

Ascend GPU CPU

mindspore.ops.ResizeNearestNeighbor

Resizes the input tensor to a given size by using the nearest neighbor algorithm.

Ascend GPU CPU

Loss Function

API Name

Description

Supported Platforms

mindspore.ops.BCEWithLogitsLoss

Adds sigmoid activation function to input as logits, and uses the given logits to compute binary cross entropy between the logits and the target.

Ascend GPU CPU

mindspore.ops.BinaryCrossEntropy

Computes the binary cross entropy between the logits and the labels.

Ascend GPU CPU

mindspore.ops.CTCLoss

Calculates the CTC (Connectionist Temporal Classification) loss and the gradient.

Ascend GPU CPU

mindspore.ops.CTCLossV2

Calculates the CTC (Connectionist Temporal Classification) loss and the gradient.

Ascend GPU CPU

mindspore.ops.KLDivLoss

Computes the Kullback-Leibler divergence between the logits and the labels.

Ascend GPU CPU

mindspore.ops.L2Loss

Calculates half of the L2 norm, but do not square the result.

Ascend GPU CPU

mindspore.ops.MultilabelMarginLoss

Creates a loss criterion that minimizes the hinge loss for multi-class classification tasks.

Ascend GPU

mindspore.ops.MultiMarginLoss

Creates a loss function that minimizes the hinge loss for multi-class classification tasks.

Ascend GPU CPU

mindspore.ops.NLLLoss

Gets the negative log likelihood loss between logits and labels.

Ascend GPU CPU

mindspore.ops.RNNTLoss

Computes the RNNTLoss and its gradient with respect to the softmax outputs.

Ascend

mindspore.ops.SigmoidCrossEntropyWithLogits

Uses the given logits to compute sigmoid cross entropy between the logits and the label.

Ascend GPU CPU

mindspore.ops.SmoothL1Loss

Calculate the smooth L1 loss, and the L1 loss function has robustness.

Ascend GPU CPU

mindspore.ops.SoftMarginLoss

Refer to mindspore.ops.soft_margin_loss() for more details.

Ascend GPU

mindspore.ops.SoftmaxCrossEntropyWithLogits

Gets the softmax cross-entropy value between logits and labels with one-hot encoding.

Ascend GPU CPU

mindspore.ops.SparseSoftmaxCrossEntropyWithLogits

Computes the softmax cross-entropy value between logits and sparse encoding labels.

GPU CPU

mindspore.ops.TripletMarginLoss

TripletMarginLoss operation.

GPU

Activation Function

API Name

Description

Supported Platforms

mindspore.ops.CeLU

Refer to mindspore.ops.celu() for more details.

Ascend GPU CPU

mindspore.ops.Elu

Refer to mindspore.ops.elu() for more details.

Ascend GPU CPU

mindspore.ops.FastGeLU

Refer to mindspore.ops.fast_gelu() for more details.

Ascend GPU CPU

mindspore.ops.GeLU

Gaussian Error Linear Units activation function.

Ascend GPU CPU

mindspore.ops.GLU

Computes GLU (Gated Linear Unit activation function) of the input tensor.

Ascend CPU

mindspore.ops.HShrink

Refer to mindspore.ops.hardshrink() for more details.

Ascend GPU CPU

mindspore.ops.HSigmoid

Refer to mindspore.ops.hardsigmoid() for more details.

Ascend GPU CPU

mindspore.ops.HSwish

Refer to mindspore.ops.hardswish() for more details.

Ascend GPU CPU

mindspore.ops.LogSoftmax

Refer to mindspore.ops.log_softmax() for more details.

Ascend GPU CPU

mindspore.ops.Mish

Computes MISH(A Self Regularized Non-Monotonic Neural Activation Function) of input tensors element-wise.

Ascend GPU CPU

mindspore.ops.PReLU

Refer to mindspore.ops.prelu() for more details.

Ascend GPU CPU

mindspore.ops.ReLU

Refer to mindspore.ops.relu() for more details.

Ascend GPU CPU

mindspore.ops.ReLU6

Refer to mindspore.ops.relu6() for more details.

Ascend GPU CPU

mindspore.ops.SeLU

Activation function SeLU (Scaled exponential Linear Unit).

Ascend GPU CPU

mindspore.ops.Sigmoid

Refer to mindspore.ops.sigmoid() for more details.

Ascend GPU CPU

mindspore.ops.Softmax

Applies the Softmax operation to the input tensor on the specified axis.

Ascend GPU CPU

mindspore.ops.Softplus

Softplus activation function.

Ascend GPU CPU

mindspore.ops.SoftShrink

Refer to mindspore.ops.softshrink() for more details.

Ascend GPU CPU

mindspore.ops.Softsign

Softsign activation function.

Ascend GPU CPU

mindspore.ops.Tanh

Refer to mindspore.ops.tanh() for more details.

Ascend GPU CPU

Optimizer

API Name

Description

Supported Platforms

mindspore.ops.Adam

Updates gradients by the Adaptive Moment Estimation (Adam) algorithm.

Ascend GPU CPU

mindspore.ops.AdamWeightDecay

Updates gradients by the Adaptive Moment Estimation algorithm with weight decay (AdamWeightDecay).

Ascend GPU CPU

mindspore.ops.AdaptiveAvgPool2D

AdaptiveAvgPool2D operation.

Ascend GPU CPU

mindspore.ops.AdaptiveAvgPool3D

AdaptiveAvgPool3D operation.

Ascend GPU CPU

mindspore.ops.ApplyAdadelta

Updates relevant entries according to the adadelta scheme.

Ascend GPU CPU

mindspore.ops.ApplyAdagrad

Updates relevant entries according to the adagrad scheme.

Ascend GPU CPU

mindspore.ops.ApplyAdagradDA

Update var according to the proximal adagrad scheme.

Ascend GPU CPU

mindspore.ops.ApplyAdagradV2

Updates relevant entries according to the adagradv2 scheme.

Ascend GPU CPU

mindspore.ops.ApplyAdaMax

Updates relevant entries according to the adamax scheme.

Ascend GPU CPU

mindspore.ops.ApplyAdamWithAmsgradV2

Update var according to the Adam algorithm.

Ascend GPU CPU

mindspore.ops.ApplyAddSign

Updates relevant entries according to the AddSign algorithm.

Ascend GPU CPU

mindspore.ops.ApplyCenteredRMSProp

Optimizer that implements the centered RMSProp algorithm.

Ascend GPU CPU

mindspore.ops.ApplyFtrl

Updates relevant entries according to the FTRL scheme.

Ascend GPU CPU

mindspore.ops.ApplyGradientDescent

Updates var by subtracting alpha * delta from it.

Ascend GPU CPU

mindspore.ops.ApplyMomentum

Optimizer that implements the Momentum algorithm.

Ascend GPU CPU

mindspore.ops.ApplyPowerSign

Updates relevant entries according to the AddSign algorithm.

Ascend GPU CPU

mindspore.ops.ApplyProximalAdagrad

Updates relevant entries according to the proximal adagrad algorithm.

Ascend GPU CPU

mindspore.ops.ApplyProximalGradientDescent

Updates relevant entries according to the FOBOS(Forward Backward Splitting) algorithm.

Ascend GPU CPU

mindspore.ops.ApplyRMSProp

Optimizer that implements the Root Mean Square prop(RMSProp) algorithm.

Ascend GPU CPU

mindspore.ops.LARSUpdate

Conducts LARS (layer-wise adaptive rate scaling) update on the sum of squares of gradient.

Ascend

mindspore.ops.SparseApplyAdagradV2

Updates relevant entries according to the adagrad scheme, one more epsilon attribute than SparseApplyAdagrad.

Ascend GPU CPU

mindspore.ops.SparseApplyProximalAdagrad

Updates relevant entries according to the proximal adagrad algorithm.

Ascend GPU

mindspore.ops.SGD

Computes the stochastic gradient descent.

Ascend GPU CPU

mindspore.ops.SparseApplyFtrl

Updates relevant entries according to the FTRL-proximal scheme For more details, please refer to mindspore.nn.FTRL.

Ascend GPU CPU

mindspore.ops.SparseApplyFtrlV2

The SparseApplyFtrlV2 interface is deprecated, please use the mindspore.ops.SparseApplyFtrl instead.

Deprecated

Distance Function

API Name

Description

Supported Platforms

mindspore.ops.Cdist

Refer to mindspore.ops.cdist() for more details.

Ascend GPU CPU

mindspore.ops.EditDistance

Computes the Levenshtein Edit Distance.

Ascend CPU

mindspore.ops.LpNorm

Return the p-norm of a matrix or vector.

Ascend GPU CPU

mindspore.ops.Pdist

Computes the p-norm distance between each pair of row vectors in the input.

GPU CPU

Sampling Operator

API Name

Description

Supported Platforms

mindspore.ops.ComputeAccidentalHits

Compute accidental hits of sampled classes which match target classes.

Ascend

mindspore.ops.LogUniformCandidateSampler

Generates random labels with a log-uniform distribution for sampled_candidates.

Ascend CPU

mindspore.ops.UniformCandidateSampler

Uniform candidate sampler.

Ascend GPU CPU

Image Processing

API Name

Description

Supported Platforms

mindspore.ops.BoundingBoxDecode

Decodes bounding boxes locations.

Ascend GPU CPU

mindspore.ops.BoundingBoxEncode

Encodes bounding boxes locations.

Ascend GPU CPU

mindspore.ops.CheckValid

Checks bounding box.

Ascend GPU CPU

mindspore.ops.CropAndResize

Extracts crops from the input image tensor and resizes them.

Ascend GPU CPU

mindspore.ops.ExtractVolumePatches

ops.ExtractVolumePatches is deprecated from version 2.3 and will be removed in a future version.

Deprecated

mindspore.ops.IOU

Calculates intersection over union for boxes.

Ascend GPU CPU

mindspore.ops.L2Normalize

L2 Normalization Operator.

Ascend GPU CPU

mindspore.ops.NMSWithMask

Non-maximum Suppression.

Ascend GPU CPU

mindspore.ops.ResizeBilinearV2

Resizes an image to a certain size using the bilinear interpolation.

Ascend GPU CPU

mindspore.ops.ROIAlign

Computes the Region of Interest (RoI) Align operator.

Ascend GPU CPU

mindspore.ops.UpsampleNearest3D

Performs nearest neighbor upsampling operation.

Ascend GPU CPU

mindspore.ops.UpsampleTrilinear3D

Performs upsampling with trilinear interpolation across 3dims for 5dim input Tensor.

Ascend GPU CPU

Text Processing

API Name

Description

Supported Platforms

mindspore.ops.NoRepeatNGram

Updates the probability of occurrence of words with its corresponding n-grams.

Ascend GPU CPU

Mathematical Operators

API Name

Description

Supported Platforms

mindspore.ops.Bincount

Counts the number of occurrences of each value in an integer array.

Ascend GPU CPU

mindspore.ops.Cholesky

Performs the Cholesky decomposition on a single or a batch of symmetric positive-definite matrices.

GPU CPU

mindspore.ops.Complex

Returns a complex Tensor from the real part and the imag part.

Ascend GPU CPU

mindspore.ops.ComplexAbs

Returns a Tensor that contains the magnitudes of the input.

Ascend GPU CPU

mindspore.ops.Cross

Returns the cross product of vectors in dimension dim of input and other.

Ascend CPU

mindspore.ops.FFTWithSize

Fourier transform, can be adjusted by parameters to achieve FFT/IFFT/RFFT/IRFFT.

Ascend GPU CPU

mindspore.ops.Gcd

Refer to mindspore.ops.gcd() for more details.

Ascend GPU CPU

Element-wise Operator

API Name

Description

Supported Platforms

mindspore.ops.Abs

Refer to mindspore.ops.abs() for more details.

Ascend GPU CPU

mindspore.ops.AccumulateNV2

Computes accumulation of all input tensors element-wise.

Ascend GPU

mindspore.ops.ACos

Refer to mindspore.ops.acos() for more details.

Ascend GPU CPU

mindspore.ops.Acosh

Refer to mindspore.ops.acosh() for more details.

Ascend GPU CPU

mindspore.ops.Add

Refer to mindspore.ops.add() for more details.

Ascend GPU CPU

mindspore.ops.Addcdiv

Adds the element-wise division of x1 by x2, multiplied by value to input_data.

Ascend GPU CPU

mindspore.ops.Addcmul

Adds the element-wise product of x1 by x2, multiplied by value to input_data.

Ascend GPU CPU

mindspore.ops.AddN

Computes addition of all input tensors element-wise.

Ascend GPU CPU

mindspore.ops.Angle

Refer to mindspore.ops.angle() for more details.

Ascend GPU CPU

mindspore.ops.Asin

Refer to mindspore.ops.asin() for more details.

Ascend GPU CPU

mindspore.ops.Asinh

Refer to mindspore.ops.asinh() for more details.

Ascend GPU CPU

mindspore.ops.Atan

Refer to mindspore.ops.atan() for more details.

Ascend GPU CPU

mindspore.ops.Atan2

Refer to mindspore.ops.atan2() for more details.

Ascend GPU CPU

mindspore.ops.Atanh

Refer to mindspore.ops.atanh() for more details.

Ascend GPU CPU

mindspore.ops.BesselI0

Computes modified Bessel function of the first kind, order 0 element-wise.

GPU CPU

mindspore.ops.BesselI0e

Computes exponential scaled modified Bessel function of the first kind, order 0 element-wise.

Ascend GPU CPU

mindspore.ops.BesselI1

Computes modified Bessel function of the first kind, order 1 element-wise.

GPU CPU

mindspore.ops.BesselI1e

Computes exponential scaled modified Bessel function of the first kind, order 1 element-wise.

Ascend GPU CPU

mindspore.ops.BesselJ0

Computes Bessel function of the first kind, order 0 element-wise.

GPU CPU

mindspore.ops.BesselJ1

Computes Bessel function of the first kind, order 1 element-wise.

GPU CPU

mindspore.ops.BesselK0

Computes modified Bessel function of the second kind, order 0 element-wise.

GPU CPU

mindspore.ops.BesselK0e

Computes exponential scaled modified Bessel function of the second kind, order 0 element-wise.

GPU CPU

mindspore.ops.BesselK1

Computes modified Bessel function of the second kind, order 1 element-wise.

GPU CPU

mindspore.ops.BesselK1e

Computes exponential scaled modified Bessel function of the second kind, order 1 element-wise.

GPU CPU

mindspore.ops.BesselY0

Computes Bessel function of the second kind, order 0 element-wise.

GPU CPU

mindspore.ops.BesselY1

Computes Bessel function of the second kind, order 1 element-wise.

GPU CPU

mindspore.ops.BitwiseAnd

Returns bitwise and of two tensors element-wise.

Ascend GPU CPU

mindspore.ops.BitwiseOr

Returns bitwise or of two tensors element-wise.

Ascend GPU CPU

mindspore.ops.BitwiseXor

Returns bitwise xor of two tensors element-wise.

Ascend GPU CPU

mindspore.ops.Ceil

Refer to mindspore.ops.ceil() for more details.

Ascend GPU CPU

mindspore.ops.Conj

Refer to mindspore.ops.conj() for more details.

Ascend GPU CPU

mindspore.ops.Cos

Refer to mindspore.ops.cos() for more details.

Ascend GPU CPU

mindspore.ops.Cosh

Refer to mindspore.ops.cosh() for more details.

Ascend GPU CPU

mindspore.ops.Digamma

Computes the grad of the lgamma function on input.

GPU CPU

mindspore.ops.Div

Computes the quotient of dividing the first input tensor by the second input tensor element-wise.

Ascend GPU CPU

mindspore.ops.DivNoNan

Operates a safe division between x1 and x2 element-wise.

Ascend GPU CPU

mindspore.ops.Einsum

Sums the product of the elements of the input Tensor along dimensions specified notation based on the Einstein summation convention(Einsum).

GPU

mindspore.ops.Erf

Refer to mindspore.ops.erf() for more details.

Ascend GPU CPU

mindspore.ops.Erfc

Refer to mindspore.ops.erfc() for more details.

Ascend GPU CPU

mindspore.ops.Erfinv

Refer to mindspore.ops.erfinv() for more details.

Ascend GPU CPU

mindspore.ops.Exp

Refer to mindspore.ops.exp() for more details.

Ascend GPU CPU

mindspore.ops.Expm1

Refer to mindspore.ops.expm1() for more details.

Ascend GPU CPU

mindspore.ops.Floor

Refer to mindspore.ops.floor() for more details.

Ascend GPU CPU

mindspore.ops.FloorDiv

Refer to mindspore.ops.floor_divide() for more details.

Ascend GPU CPU

mindspore.ops.FloorMod

Refer to mindspore.ops.floor_mod() for more details.

Ascend GPU CPU

mindspore.ops.Geqrf

Refer to mindspore.ops.geqrf() for more details.

Ascend GPU CPU

mindspore.ops.Imag

Returns a new tensor containing imaginary value of the input.

Ascend GPU CPU

mindspore.ops.Inv

Computes Reciprocal of input tensor element-wise.

Ascend GPU CPU

mindspore.ops.Invert

Flips all bits of input tensor element-wise.

Ascend GPU CPU

mindspore.ops.Lerp

Refer to mindspore.ops.lerp() for more details.

Ascend GPU CPU

mindspore.ops.Log

Refer to mindspore.ops.log() for more details.

Ascend GPU CPU

mindspore.ops.Log1p

Refer to mindspore.ops.log1p() for more details.

Ascend GPU CPU

mindspore.ops.LogicalAnd

Computes the "logical AND" of two tensors element-wise.

Ascend GPU CPU

mindspore.ops.LogicalNot

Computes the "logical NOT" of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.LogicalOr

Computes the "logical OR" of two tensors element-wise.

Ascend GPU CPU

mindspore.ops.LogicalXor

Computes the "logical XOR" of two tensors element-wise.

Ascend CPU

mindspore.ops.Logit

Calculate the logit of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.Mod

Computes the remainder of dividing the first input tensor by the second input tensor element-wise.

Ascend GPU CPU

mindspore.ops.Mul

Refer to mindspore.ops.mul() for more details.

Ascend GPU CPU

mindspore.ops.MulNoNan

Computes x * y element-wise.

Ascend GPU CPU

mindspore.ops.Neg

Refer to mindspore.ops.neg() for more details.

Ascend GPU CPU

mindspore.ops.NextAfter

Refer to mindspore.ops.nextafter() for more details.

Ascend GPU CPU

mindspore.ops.Pow

Refer to mindspore.ops.pow() for more details.

Ascend GPU CPU

mindspore.ops.Polar

Converts polar coordinates to Cartesian coordinates.

Ascend GPU CPU

mindspore.ops.Polygamma

Computes the \(a\).

GPU CPU

mindspore.ops.Real

Refer to mindspore.ops.real() for more details.

Ascend GPU CPU

mindspore.ops.RealDiv

Divides the first input tensor by the second input tensor in floating-point type element-wise.

Ascend GPU CPU

mindspore.ops.Reciprocal

Returns reciprocal of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.Rint

Returns an integer that is closest to input_x element-wise.

Ascend GPU CPU

mindspore.ops.Round

Returns half to even of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.Rsqrt

Refer to mindspore.ops.rsqrt() for more details.

Ascend GPU CPU

mindspore.ops.Sign

Refer to mindspore.ops.sign() for more details.

Ascend GPU CPU

mindspore.ops.Sin

Refer to mindspore.ops.sin() for more details.

Ascend GPU CPU

mindspore.ops.Sinc

Refer to mindspore.ops.sinc() for more details.

Ascend GPU CPU

mindspore.ops.Sinh

Refer to mindspore.ops.sinh() for more details.

Ascend GPU CPU

mindspore.ops.Sqrt

Refer to mindspore.ops.sqrt() for more details.

Ascend GPU CPU

mindspore.ops.Square

Refer to mindspore.ops.square() for more details.

Ascend GPU CPU

mindspore.ops.SquaredDifference

Subtracts the second input tensor from the first input tensor element-wise and returns square of it.

Ascend GPU CPU

mindspore.ops.SquareSumAll

Returns the square sum of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.Sub

Subtracts the second input tensor from the first input tensor element-wise.

Ascend GPU CPU

mindspore.ops.Tan

Computes tangent of input element-wise.

Ascend GPU CPU

mindspore.ops.Trunc

Refer to mindspore.ops.trunc() for more details.

Ascend GPU CPU

mindspore.ops.TruncateDiv

Divides the first input tensor by the second input tensor element-wise and rounds the results of division towards zero.

Ascend GPU CPU

mindspore.ops.TruncateMod

Returns the remainder of division element-wise.

Ascend GPU CPU

mindspore.ops.Xdivy

Divides the first input tensor by the second input tensor element-wise.

Ascend GPU CPU

mindspore.ops.Xlogy

Computes the first input tensor multiplied by the logarithm of second input tensor element-wise.

Ascend GPU CPU

mindspore.ops.Zeta

Compute the Hurwitz zeta function ζ(x,q) of input Tensor.

Ascend GPU CPU

Reduction Operator

API Name

Description

Supported Platforms

mindspore.ops.Argmax

Returns the indices of the maximum value along a specified axis of a Tensor.

Ascend GPU CPU

mindspore.ops.ArgMaxWithValue

Calculates the maximum value along with the given axis for the input tensor, and returns the maximum values and indices.

Ascend GPU CPU

mindspore.ops.Argmin

Returns the indices of the minimum value along a specified axis of a Tensor.

Ascend GPU CPU

mindspore.ops.ArgMinWithValue

Calculates the minimum value along with the given axis for the input tensor, and returns the minimum values and indices.

Ascend GPU CPU

mindspore.ops.Median

Computes the median and its corresponding indices of input tensor in the axis dimension.

GPU CPU

mindspore.ops.ReduceAll

Refer to mindspore.ops.all() for more details.

Ascend GPU CPU

mindspore.ops.ReduceAny

Reduces a dimension of a tensor by the "logical OR" of all elements in the dimension, by default.

Ascend GPU CPU

mindspore.ops.ReduceMax

Reduces a dimension of a tensor by the maximum value in this dimension, by default.

Ascend GPU CPU

mindspore.ops.ReduceMean

Reduces a dimension of a tensor by averaging all elements in the dimension, by default.

Ascend GPU CPU

mindspore.ops.ReduceMin

Reduces a dimension of a tensor by the minimum value in the dimension, by default.

Ascend GPU CPU

mindspore.ops.ReduceProd

Reduces a dimension of a tensor by multiplying all elements in the dimension, by default.

Ascend GPU CPU

mindspore.ops.ReduceSum

Reduces a dimension of a tensor by summing all elements in the dimension, by default.

Ascend GPU CPU

Comparison Operator

API Name

Description

Supported Platforms

mindspore.ops.ApproximateEqual

Returns True if abs(x-y) is smaller than tolerance element-wise, otherwise False.

Ascend GPU CPU

mindspore.ops.Equal

Refer to mindspore.ops.equal() for more details.

Ascend GPU CPU

mindspore.ops.EqualCount

Computes the number of the same elements of two tensors.

Ascend GPU CPU

mindspore.ops.Greater

Refer to mindspore.ops.greater() for more details.

Ascend GPU CPU

mindspore.ops.GreaterEqual

Refer to mindspore.ops.greater_equal() for more details.

Ascend GPU CPU

mindspore.ops.InTopK

Determines whether the targets are in the top k predictions.

Ascend GPU CPU

mindspore.ops.IsFinite

Refer to mindspore.ops.isfinite() for more details.

Ascend GPU CPU

mindspore.ops.IsInf

Refer to mindspore.ops.isinf() for more details.

Ascend CPU GPU

mindspore.ops.IsNan

Determines which elements are NaN for each position.

Ascend GPU CPU

mindspore.ops.Less

Refer to mindspore.ops.less() for more details.

Ascend GPU CPU

mindspore.ops.LessEqual

Refer to mindspore.ops.less_equal() for more details.

Ascend GPU CPU

mindspore.ops.Maximum

Refer to mindspore.ops.maximum() for more details.

Ascend GPU CPU

mindspore.ops.Minimum

Refer to mindspore.ops.minimum() for more details.

Ascend GPU CPU

mindspore.ops.NotEqual

Refer to mindspore.ops.not_equal() for more details.

Ascend GPU CPU

mindspore.ops.TopK

Finds values and indices of the k largest entries along the last dimension.

Ascend GPU CPU

Linear Algebraic Operator

API Name

Description

Supported Platforms

mindspore.ops.BatchMatMul

Computes matrix multiplication between two tensors by batch.

Ascend GPU CPU

mindspore.ops.BiasAdd

Returns the sum of the input Tensor and the bias Tensor.

Ascend GPU CPU

mindspore.ops.Ger

Ger product of x1 and x2.

Ascend GPU CPU

mindspore.ops.MatMul

Multiplies matrix a and matrix b.

Ascend GPU CPU

mindspore.ops.MatrixInverse

Returns the inverse of the input matrix.

Ascend GPU CPU

mindspore.ops.Ormqr

Computes the matrix-matrix multiplication of a product of Householder matrices with a general matrix.

GPU

mindspore.ops.Orgqr

Calculates the explicit representation of the orthogonal matrix \(Q\) returned by mindspore.ops.Geqrf.

Ascend GPU CPU

mindspore.ops.Svd

Computes the singular value decompositions of one or more matrices.

Ascend GPU CPU

Tensor Operation Operator

Tensor Construction

API Name

Description

Supported Platforms

mindspore.ops.Eps

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.

Ascend GPU CPU

mindspore.ops.Eye

Returns a tensor with ones on the diagonal and zeros in the rest.

Ascend GPU CPU

mindspore.ops.Fill

The Fill interface is deprecated, please use the mindspore.ops.FillV2 instead.

Deprecated

mindspore.ops.LinSpace

Generate a one-dimensional tensor with steps elements, evenly distributed in the interval [start, end].

Ascend GPU CPU

mindspore.ops.OneHot

Computes a one-hot tensor.

Ascend GPU CPU

mindspore.ops.Ones

Creates a tensor filled with value ones.

Ascend GPU CPU

mindspore.ops.OnesLike

Returns a Tensor with a value of 1 and its shape and data type is the same as the input.

Ascend GPU CPU

mindspore.ops.Zeros

Zeros will be deprecated in the future.

Ascend GPU CPU

mindspore.ops.ZerosLike

Returns a Tensor with a value of 0 and its shape and data type is the same as the input.

Ascend GPU CPU

Random Generation Operator

API Name

Description

Supported Platforms

mindspore.ops.Bernoulli

Randomly set the elements of output to 0 or 1 with the probability of P which follows the Bernoulli distribution.

GPU CPU

mindspore.ops.Gamma

Produces random positive floating-point values x, distributed according to probability density function:

Ascend

mindspore.ops.Multinomial

Returns a tensor sampled from the multinomial probability distribution located in the corresponding row of tensor input.

Ascend GPU CPU

mindspore.ops.MultinomialWithReplacement

Returns a tensor where each row contains numsamples indices sampled from the multinomial distribution with replacement.

CPU

mindspore.ops.RandomCategorical

Generates random samples from a given categorical distribution tensor.

Ascend GPU CPU

mindspore.ops.RandomChoiceWithMask

Generates a random sample as index tensor with a mask tensor from a given tensor.

Ascend GPU CPU

mindspore.ops.RandomGamma

Produces random positive floating-point values x, distributed according to probability density function:

CPU

mindspore.ops.RandomPoisson

Produces random non-negative values i, distributed according to discrete probability function:

GPU CPU

mindspore.ops.Randperm

Generates n random samples from 0 to n-1 without repeating.

Ascend GPU

mindspore.ops.RandpermV2

Refer to mindspore.ops.randperm() for more details.

CPU

mindspore.ops.StandardLaplace

Generates random numbers according to the Laplace random number distribution (mean=0, lambda=1).

Ascend GPU CPU

mindspore.ops.StandardNormal

Generates random numbers according to the standard Normal (or Gaussian) random number distribution.

Ascend GPU CPU

mindspore.ops.UniformInt

Produces random integer values i, uniformly distributed on the closed interval [minval, maxval), that is, distributed according to the discrete probability function:

Ascend GPU CPU

mindspore.ops.UniformReal

Produces random floating-point values, uniformly distributed to the interval [0, 1).

Ascend GPU CPU

Array Operation

API Name

Description

Supported Platforms

mindspore.ops.AffineGrid

Creates a 2D or 3D flow field (sampling grid) based on a batch of affine matrices theta.

Ascend GPU CPU

mindspore.ops.BatchToSpace

Divides batch dimension with blocks and interleaves these blocks back into spatial dimensions.

Ascend GPU

mindspore.ops.BatchToSpaceND

Please use batch_to_space_nd instead.

Deprecated

mindspore.ops.BroadcastTo

Refer to mindspore.ops.broadcast_to() for more details.

Ascend GPU CPU

mindspore.ops.Cast

Returns a tensor with the new specified data type.

Ascend GPU CPU

mindspore.ops.ChannelShuffle

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.

Ascend CPU

mindspore.ops.Col2Im

Rearranges a row vector to an image.

Ascend GPU CPU

mindspore.ops.Concat

Refer to mindspore.ops.cat() for more details.

Ascend GPU CPU

mindspore.ops.Cummax

Refer to mindspore.ops.cummax() for more details.

Ascend GPU CPU

mindspore.ops.Cummin

Returns the cumulative minimum of elements and the index.

Ascend GPU CPU

mindspore.ops.CumProd

Computes the cumulative product of the tensor x along axis.

Ascend GPU CPU

mindspore.ops.CumSum

Computes the cumulative sum of input tensor along axis.

Ascend GPU CPU

mindspore.ops.DataFormatDimMap

Returns the dimension index in the destination data format given in the source data format.

Ascend GPU CPU

mindspore.ops.DepthToSpace

Rearrange blocks of depth data into spatial dimensions.

Ascend GPU CPU

mindspore.ops.Diag

Refer to mindspore.ops.diag() for more details.

Ascend GPU CPU

mindspore.ops.DType

Returns the data type of the input tensor as mindspore.dtype.

Ascend GPU CPU

mindspore.ops.ExpandDims

Refer to mindspore.ops.expand_dims() for more details.

Ascend GPU CPU

mindspore.ops.FillDiagonal

Fills the main diagonal of a Tensor in-place with a specified value and returns the result.

Ascend GPU CPU

mindspore.ops.FillV2

Creates a tensor with shape described by shape and fills it with values in value .

Ascend GPU CPU

mindspore.ops.FloatStatus

Determines if the elements contain Not a Number(NaN), infinite or negative infinite.

GPU

mindspore.ops.Fmax

Computes the maximum of input tensors element-wise.

CPU

mindspore.ops.Gather

Refer to mindspore.ops.gather() for more details.

Ascend GPU CPU

mindspore.ops.GatherD

Refer to mindspore.ops.gather_d() for more details.

Ascend GPU CPU

mindspore.ops.GatherNd

Refer to mindspore.ops.gather_nd() for more details.

Ascend GPU CPU

mindspore.ops.HammingWindow

Computes the hamming window function with input window length.

Ascend GPU CPU

mindspore.ops.Heaviside

Applies the Heaviside step function for input x element-wise.

Ascend GPU CPU

mindspore.ops.HistogramFixedWidth

Returns a rank 1 histogram counting the number of entries in values that fall into every bin.

Ascend GPU

mindspore.ops.Hypot

Computes hypotenuse of input tensors element-wise as legs of a right triangle.

Ascend GPU CPU

mindspore.ops.Identity

Refer to mindspore.ops.deepcopy() for more details.

Ascend GPU CPU

mindspore.ops.Igamma

Calculates lower regularized incomplete Gamma function.

Ascend GPU CPU

mindspore.ops.Igammac

Compute the upper regularized incomplete Gamma function Q(a, x).

Ascend GPU CPU

mindspore.ops.Im2Col

Extracts sliding local blocks from a batched input tensor.

Ascend GPU CPU

mindspore.ops.IndexAdd

Adds tensor y to specified axis and indices of tensor x.

Ascend GPU CPU

mindspore.ops.IndexFill

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.

Ascend GPU CPU

mindspore.ops.IndexPut

According to the index number of indexes, replace the value corresponding to x1 with the value in x2.

Ascend CPU

mindspore.ops.InplaceAdd

Adds v into specified rows of x.

Ascend GPU CPU

mindspore.ops.InplaceIndexAdd

Adds Tensor updates to specified axis and indices of Tensor var element-wise.

Ascend CPU

mindspore.ops.InplaceSub

Subtracts v into specified rows of x.

Ascend GPU CPU

mindspore.ops.InplaceUpdate

Please use mindspore.ops.InplaceUpdateV2 instead.

Deprecated

mindspore.ops.InplaceUpdateV2

Updates specified values in x to v according to indices.

GPU CPU

mindspore.ops.InvertPermutation

Computes the inverse of an index permutation.

Ascend GPU CPU

mindspore.ops.IsClose

Returns a tensor of Boolean values indicating whether each element of input is "close" to the corresponding element of other.

Ascend GPU CPU

mindspore.ops.Lcm

Computes least common multiplier of input tensors element-wise.

Ascend GPU CPU

mindspore.ops.LeftShift

Shift the value of each position of the tensor to the left several bits.

Ascend GPU CPU

mindspore.ops.LogSpace

Generates a 1-D Tensor with a length of steps.

Ascend GPU CPU

mindspore.ops.LuUnpack

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.

GPU CPU

mindspore.ops.MaskedFill

Refer to mindspore.ops.masked_fill() for more details.

Ascend GPU CPU

mindspore.ops.MaskedScatter

Updates the value in the input with value in updates according to the mask.

Ascend CPU

mindspore.ops.MaskedSelect

Refer to mindspore.ops.masked_select() for more details.

Ascend GPU CPU

mindspore.ops.MatrixBandPart

Extracts the central diagonal band of each matrix in a tensor, with all values outside the central band set to zero.

Ascend GPU CPU

mindspore.ops.MatrixDiagPartV3

Returns the diagonal part of a tensor.

Ascend GPU CPU

mindspore.ops.MatrixDiagV3

Constructs a diagonal matrix or a batch of diagonal matrices from a given input Tensor.

Ascend GPU CPU

mindspore.ops.MatrixSetDiagV3

Updates the diagonal part of a batched tensor.

Ascend GPU CPU

mindspore.ops.MatrixSolve

Solves systems of linear equations.

Ascend CPU

mindspore.ops.Meshgrid

Generates coordinate matrices from given coordinate tensors.

Ascend GPU CPU

mindspore.ops.Mvlgamma

Calculates the multivariate log-gamma function element-wise for a given dimension p.

Ascend GPU CPU

mindspore.ops.NanToNum

Refer to mindspore.ops.nan_to_num() for more details.

Ascend CPU

mindspore.ops.NonZero

Return a Tensor of the positions of all non-zero values.

Ascend GPU CPU

mindspore.ops.ParallelConcat

Concats input tensors along the first dimension.

Ascend GPU CPU

mindspore.ops.PopulationCount

Computes element-wise population count(a.k.a bitsum, bitcount).

Ascend GPU CPU

mindspore.ops.RandomShuffle

Randomly shuffles a Tensor along its first dimension.

Ascend GPU CPU

mindspore.ops.Range

Refer to mindspore.ops.range() for more details.

GPU CPU

mindspore.ops.Rank

Returns the rank of a tensor.

Ascend GPU CPU

mindspore.ops.Renorm

Renormalizes the sub-tensors along dimension dim, and each sub-tensor's p-norm should not exceed the 'maxnorm'.

Ascend GPU CPU

mindspore.ops.Reshape

Refer to mindspore.ops.reshape() for more details.

Ascend GPU CPU

mindspore.ops.ReverseSequence

Reverses variable length slices.

Ascend GPU CPU

mindspore.ops.ReverseV2

Refer to mindspore.ops.flip() for more details.

Ascend GPU CPU

mindspore.ops.RightShift

Shift the value of each position of Tensor input_x to the right by corresponding bits in Tensor input_y.

Ascend GPU CPU

mindspore.ops.ScatterNd

Refer to mindspore.ops.scatter_nd() for more details.

Ascend GPU CPU

mindspore.ops.ScatterNdDiv

Applies sparse division to individual values or slices in a tensor.

GPU CPU

mindspore.ops.ScatterNdMax

Computes sparse maximum to individual values or slices in a tensor.

Ascend GPU CPU

mindspore.ops.ScatterNdMin

Applies sparse minimum to individual values or slices in a tensor.

Ascend GPU CPU

mindspore.ops.ScatterNdMul

Applies sparse multiplication to individual values or slices in a tensor.

GPU CPU

mindspore.ops.SearchSorted

Return the position indices where the elements can be inserted into the input tensor to maintain the increasing order of the input tensor.

Ascend GPU CPU

mindspore.ops.Select

Refer to mindspore.ops.select() for more details.

Ascend GPU CPU

mindspore.ops.Shape

Returns the shape of the input tensor.

Ascend GPU CPU

mindspore.ops.Size

Returns a Scalar of type int that represents the size of the input Tensor and the total number of elements in the Tensor.

Ascend GPU CPU

mindspore.ops.Slice

Slices a tensor in the specified shape.

Ascend GPU CPU

mindspore.ops.Sort

Sorts the elements of the input tensor along the given dimension in the specified order.

Ascend GPU CPU

mindspore.ops.SpaceToBatchND

Divides spatial dimensions into blocks and combines the block size with the original batch.

Ascend GPU CPU

mindspore.ops.SpaceToDepth

Rearrange blocks of spatial data into depth.

Ascend GPU CPU

mindspore.ops.SparseGatherV2

Returns a slice of input tensor based on the specified indices and axis.

Ascend GPU

mindspore.ops.Split

Splits the input tensor into output_num of tensors along the given axis and output numbers.

Ascend GPU CPU

mindspore.ops.Squeeze

Return the Tensor after deleting the dimension of size 1 in the specified axis.

Ascend GPU CPU

mindspore.ops.Stack

Stacks a list of tensors in specified axis.

Ascend GPU CPU

mindspore.ops.StridedSlice

Refer to mindspore.ops.strided_slice() for more details.

Ascend GPU CPU

mindspore.ops.TensorScatterAdd

Creates a new tensor by adding the values from the positions in input_x indicated by indices, with values from updates.

Ascend GPU CPU

mindspore.ops.TensorScatterDiv

Creates a new tensor by dividing the values from the positions in input_x indicated by indices, with values from updates.

GPU CPU

mindspore.ops.TensorScatterMax

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.

GPU CPU

mindspore.ops.TensorScatterMin

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.

Ascend GPU CPU

mindspore.ops.TensorScatterMul

Creates a new tensor by multiplying the values from the positions in input_x indicated by indices, with values from updates.

GPU CPU

mindspore.ops.TensorScatterSub

Creates a new tensor by subtracting the values from the positions in input_x indicated by indices, with values from updates.

Ascend GPU CPU

mindspore.ops.TensorScatterUpdate

Creates a new tensor by updating the positions in input_x indicated by indices, with values from update.

Ascend GPU CPU

mindspore.ops.TensorShape

Returns the shape of the input tensor.

Ascend GPU CPU

mindspore.ops.Tile

Replicates an input tensor with given multiple times.

Ascend GPU CPU

mindspore.ops.Trace

Refer to mindspore.ops.trace() for more details.

Ascend GPU CPU

mindspore.ops.Transpose

Refer to mindspore.ops.transpose() for more details.

Ascend GPU CPU

mindspore.ops.Tril

Returns the lower triangular portion of the 2-D matrix or the set of matrices in a batch.

Ascend GPU CPU

mindspore.ops.TrilIndices

Computes the indices of the lower triangular elements of a 2D matrix and returns them as a Tensor.

Ascend GPU CPU

mindspore.ops.Triu

Refer to mindspore.ops.triu() for more details.

Ascend GPU CPU

mindspore.ops.TriuIndices

Calculates the indices of the upper triangular elements in a row * col matrix and returns them as a 2-by-N Tensor.

Ascend GPU CPU

mindspore.ops.Unique

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.

Ascend GPU CPU

mindspore.ops.UniqueConsecutive

Returns the elements that are unique in each consecutive group of equivalent elements in the input tensor.

Ascend GPU CPU

mindspore.ops.UniqueWithPad

'ops.UniqueWithPad' is deprecated from version 2.4 and will be removed in a future version.

Deprecated

mindspore.ops.UnsortedSegmentMax

Computes the maximum along segments of a tensor.

Ascend GPU CPU

mindspore.ops.UnsortedSegmentMin

Computes the minimum of a tensor along segments.

Ascend GPU CPU

mindspore.ops.UnsortedSegmentProd

Computes the product of a tensor along segments.

Ascend GPU CPU

mindspore.ops.UnsortedSegmentSum

Refer to mindspore.ops.unsorted_segment_sum() for more details.

Ascend GPU CPU

mindspore.ops.Unstack

Unstacks tensor in specified axis, this is the opposite of ops.Stack.

Ascend GPU CPU

Type Conversion

API Name

Description

Supported Platforms

mindspore.ops.ScalarCast

'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

mindspore.ops.ScalarToTensor

Converts a scalar to a Tensor, and converts the data type to the specified type.

Ascend GPU CPU

mindspore.ops.TupleToArray

Converts a tuple to a tensor.

Ascend GPU CPU

Parameter Operation Operator

API Name

Description

Supported Platforms

mindspore.ops.Assign

Refer to mindspore.ops.assign() for more details.

Ascend GPU CPU

mindspore.ops.AssignAdd

Refer to mindspore.ops.assign_add() for more details.

Ascend GPU CPU

mindspore.ops.AssignSub

Refer to mindspore.ops.assign_sub() for more details.

Ascend GPU CPU

mindspore.ops.ScatterAdd

Updates the value of the input tensor through the addition operation.

Ascend GPU CPU

mindspore.ops.ScatterDiv

Updates the value of the input tensor through the divide operation.

Ascend GPU CPU

mindspore.ops.ScatterMax

Updates the value of the input tensor through the maximum operation.

Ascend GPU CPU

mindspore.ops.ScatterMin

Updates the value of the input tensor through the minimum operation.

Ascend GPU CPU

mindspore.ops.ScatterMul

Updates the value of the input tensor through the multiply operation.

Ascend GPU CPU

mindspore.ops.ScatterNdAdd

Applies sparse addition to individual values or slices in a tensor.

Ascend GPU CPU

mindspore.ops.ScatterNdSub

Applies sparse subtraction to individual values or slices in a tensor.

Ascend GPU CPU

mindspore.ops.ScatterNdUpdate

Updates tensor values by using input indices and value.

Ascend GPU CPU

mindspore.ops.ScatterNonAliasingAdd

Please use TensorScatterAdd instead.

Deprecated

mindspore.ops.ScatterSub

Updates the value of the input tensor through the subtraction operation.

Ascend GPU CPU

mindspore.ops.ScatterUpdate

Updates tensor values by using input indices and value.

Ascend GPU CPU

Data Operation Operator

API Name

Description

Supported Platforms

mindspore.ops.GetNext

Returns the next element in the dataset queue.

Ascend GPU

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

mindspore.ops.AllGather

Gathers tensors from the specified communication group and returns the tensor which is all gathered.

Ascend GPU

mindspore.ops.AllReduce

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.

Ascend GPU CPU

mindspore.ops.AlltoAll

AlltoAll is a collective operation.

Ascend

mindspore.ops.AlltoAllV

AllToAllV which support uneven scatter and gather compared with AllToAll.

Ascend

mindspore.ops.Barrier

Synchronizes all processes in the specified group.

Ascend

mindspore.ops.Broadcast

Broadcasts the tensor to the whole group.

Ascend GPU

mindspore.ops.CollectiveGather

Gathers tensors from the specified communication group.

Ascend

mindspore.ops.CollectiveScatter

Scatter input data evently across the processes in the specified communication group.

Ascend

mindspore.ops.NeighborExchangeV2

NeighborExchangeV2 is a collective communication operation.

Ascend

mindspore.ops.Receive

Receive tensors from src_rank.

Ascend GPU

mindspore.ops.ReduceOp

Operation options for reducing tensors.

Ascend GPU

mindspore.ops.ReduceScatter

Reduces and scatters tensors from the specified communication group and returns the tensor which is reduced and scattered.

Ascend GPU

mindspore.ops.Reduce

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.

Ascend

mindspore.ops.Send

Send tensors to the specified dest_rank.

Ascend GPU

Debugging Operator

API Name

Description

Supported Platforms

mindspore.ops.HistogramSummary

This operator will calculate the histogram of a tensor and put it to a summary file with protocol buffer format.

Ascend GPU CPU

mindspore.ops.ImageSummary

This operator will put an image tensor to a summary file with protocol buffer format.

Ascend GPU CPU

mindspore.ops.ScalarSummary

This operator will put a scalar to a summary file with protocol buffer format.

Ascend GPU CPU

mindspore.ops.TensorSummary

This operator will put a tensor to a summary file with protocol buffer format.

Ascend GPU CPU

mindspore.ops.TensorDump

Save the Tensor as an npy file in numpy format.

Ascend

mindspore.ops.Print

Print the inputs to stdout.

Ascend GPU CPU

mindspore.ops.NPUAllocFloatStatus

Allocates a flag to store the overflow status.

Ascend

mindspore.ops.NPUClearFloatStatus

Clears the flag which stores the overflow status.

Ascend

mindspore.ops.NPUGetFloatStatus

mindspore.ops.NPUGetFloatStatus updates the flag which is the output tensor of mindspore.ops.NPUAllocFloatStatus with the latest overflow status.

Ascend

Sparse Operator

API Name

Description

Supported Platforms

mindspore.ops.SparseTensorDenseMatmul

Multiplies sparse matrix A by dense matrix B.

GPU CPU

mindspore.ops.SparseToDense

Converts a sparse representation into a dense tensor.

CPU

Frame Operators

API Name

Description

Supported Platforms

mindspore.ops.Depend

Depend is used for processing dependency operations.

Ascend GPU CPU

mindspore.ops.ForiLoop

Performs a loop operation within the specified range.

Ascend GPU CPU

mindspore.ops.GradOperation

A higher-order function which is used to generate the gradient function for the input function.

Ascend GPU CPU

mindspore.ops.HookBackward

This operation is used as a tag to hook gradient in intermediate variables.

Ascend GPU CPU

mindspore.ops.HyperMap

HyperMap will apply the set operation to input sequences.

Ascend GPU CPU

mindspore.ops.InsertGradientOf

Attaches callback to the graph node that will be invoked on the node's gradient.

Ascend GPU CPU

mindspore.ops.Morph

The Morph Primitive is used to encapsulate a user-defined function fn, allowing it to be used as a custom Primitive.

mindspore.ops.Map

Map will apply the set operation on input sequences.

Ascend GPU CPU

mindspore.ops.MultitypeFuncGraph

MultitypeFuncGraph is a class used to generate overloaded functions, considering different types as inputs.

Ascend GPU CPU

mindspore.ops.Partial

Makes a partial function instance.

Ascend GPU CPU

mindspore.ops.Scan

Scan a function over an array while the processing of the current element depends on the execution result of the previous element.

Ascend GPU CPU

mindspore.ops.WhileLoop

Provide a useful op for reducing compilation times of while loop.

Ascend GPU CPU

Operator Information Registration

mindspore.ops.AiCPURegOp

Class for AiCPU operator information registration.

mindspore.ops.CustomRegOp

Class used for generating the registration information for the func parameter of mindspore.ops.Custom.

mindspore.ops.DataType

Various combinations of dtype and format of Ascend ops.

mindspore.ops.TBERegOp

Class for TBE operator information registration.

mindspore.ops.get_vm_impl_fn

Gets the virtual implementation function by a primitive object or primitive name.

Customizing Operator

API Name

Description

Supported Platforms

mindspore.ops.Custom

Custom primitive is used for user defined operators and is to enhance the expressive ability of built-in primitives.

Ascend GPU CPU

mindspore.ops.CustomOpBuilder

CustomOpBuilder is used to initialize and configure custom operators for MindSpore.

Ascend CPU

mindspore.ops.custom_info_register

A decorator which is used to bind the registration information to the func parameter of mindspore.ops.Custom.

Ascend GPU CPU

mindspore.ops.kernel

The decorator of the Hybrid DSL function for the Custom Op.

GPU CPU

Spectral Operator

API Name

Description

Supported Platforms

mindspore.ops.BartlettWindow

Bartlett window function.

Ascend GPU CPU

mindspore.ops.BlackmanWindow

Blackman window function.

Ascend GPU CPU