mindspore.ops

Operators can be used in the construct function of Cell.

Examples

>>> import mindspore.ops as ops

Compared with the previous version, the added, deleted and supported platforms change information of mindspore.ops operators in MindSpore, please refer to the link https://gitee.com/mindspore/docs/blob/r1.6/resource/api_updates/ops_api_updates.md.

operations

The Primitive operators in operations need to be instantiated before being used.

Neural Network Operators

API Name

Description

Supported Platforms

mindspore.ops.Acosh

Computes inverse hyperbolic cosine of the inputs element-wise.

Ascend GPU CPU

mindspore.ops.Adam

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

Ascend GPU CPU

mindspore.ops.AdamNoUpdateParam

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

CPU

mindspore.ops.AdamWeightDecay

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

GPU CPU

mindspore.ops.AdaptiveAvgPool2D

AdaptiveAvgPool2D operation.

GPU

mindspore.ops.ApplyAdadelta

Updates relevant entries according to the adadelta scheme.

Ascend

mindspore.ops.ApplyAdagrad

Updates relevant entries according to the adagrad scheme.

Ascend CPU GPU

mindspore.ops.ApplyAdagradDA

Update var according to the proximal adagrad scheme.

Ascend

mindspore.ops.ApplyAdagradV2

Updates relevant entries according to the adagradv2 scheme.

Ascend

mindspore.ops.ApplyAdaMax

Updates relevant entries according to the adamax scheme.

Ascend

mindspore.ops.ApplyAddSign

Updates relevant entries according to the AddSign algorithm.

Ascend

mindspore.ops.ApplyCenteredRMSProp

Optimizer that implements the centered RMSProp algorithm.

Ascend GPU CPU

mindspore.ops.ApplyGradientDescent

Updates var by subtracting alpha * delta from it.

Ascend GPU

mindspore.ops.ApplyMomentum

Optimizer that implements the Momentum algorithm.

Ascend GPU CPU

mindspore.ops.ApplyPowerSign

Updates relevant entries according to the AddSign algorithm.

Ascend

mindspore.ops.ApplyProximalAdagrad

Updates relevant entries according to the proximal adagrad algorithm.

Ascend

mindspore.ops.ApplyProximalGradientDescent

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

Ascend

mindspore.ops.ApplyRMSProp

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

Ascend GPU CPU

mindspore.ops.AvgPool

Average pooling operation.

Ascend GPU CPU

mindspore.ops.AvgPool3D

3D Average pooling operation.

Ascend

mindspore.ops.BasicLSTMCell

It's similar to operator DynamicRNN.

Deprecated

mindspore.ops.BatchNorm

Batch Normalization for input data and updated parameters.

Ascend CPU GPU

mindspore.ops.BCEWithLogitsLoss

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

Ascend GPU

mindspore.ops.BiasAdd

Returns sum of input and bias tensor.

Ascend GPU CPU

mindspore.ops.BinaryCrossEntropy

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

Ascend GPU CPU

mindspore.ops.ComputeAccidentalHits

Compute accidental hits of sampled classes which match target classes.

Ascend

mindspore.ops.Conv2D

2D convolution layer.

Ascend GPU CPU

mindspore.ops.Conv2DBackpropInput

The Conv2DBackpropInput interface is deprecated, please refer to mindspore.ops.Conv2dTranspose if you want to do unsampling.

Deprecated

mindspore.ops.Conv2DTranspose

Compute a 2D transposed convolution, which is also known as a 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

mindspore.ops.CTCGreedyDecoder

Performs greedy decoding on the logits given in inputs.

Ascend

mindspore.ops.CTCLoss

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

Ascend GPU CPU

mindspore.ops.DataFormatDimMap

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

Ascend

mindspore.ops.DepthwiseConv2dNative

DepthwiseConv2dNative will be deprecated in the future.

Deprecated

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 of the channels of the input tensor with probability 1-keep_prob 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).

Ascend

mindspore.ops.Dropout3D

During training, randomly zeroes some of the 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

mindspore.ops.DropoutDoMask

The DropoutDoMask interface is deprecated, please use the mindspore.ops.Dropout instead.

Deprecated

mindspore.ops.DropoutGenMask

The DropoutGenMask interface is deprecated, please use the mindspore.ops.Dropout instead.

Deprecated

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

Computes exponential linear:

Ascend GPU CPU

mindspore.ops.FastGeLU

Fast Gaussian Error Linear Units activation function.

Ascend

mindspore.ops.Flatten

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

Ascend GPU CPU

mindspore.ops.FloorMod

Computes the remainder of division element-wise.

Ascend GPU CPU

mindspore.ops.FusedSparseAdam

Merges the duplicate value of the gradient and then updates parameters by the Adaptive Moment Estimation (Adam) algorithm.

Ascend CPU

mindspore.ops.FusedSparseLazyAdam

Merges the duplicate value of the gradient and then updates parameters by the Adaptive Moment Estimation (Adam) algorithm.

Ascend CPU

mindspore.ops.FusedSparseProximalAdagrad

Merges the duplicate value of the gradient and then updates relevant entries according to the proximal adagrad algorithm.

Ascend CPU

mindspore.ops.GeLU

Gaussian Error Linear Units activation function.

Ascend GPU CPU

mindspore.ops.GetNext

Returns the next element in the dataset queue.

Ascend GPU

mindspore.ops.HShrink

Applies the hard shrinkage function element-wise, each element complies with the following function:

Ascend

mindspore.ops.HSigmoid

Hard sigmoid activation function.

Ascend GPU CPU

mindspore.ops.HSwish

Hard swish activation function.

GPU CPU

mindspore.ops.KLDivLoss

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

GPU

mindspore.ops.L2Loss

Calculates half of the L2 norm of a tensor without sqrt.

Ascend GPU CPU

mindspore.ops.L2Normalize

L2 Normalization Operator.

Ascend GPU CPU

mindspore.ops.LARSUpdate

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

Ascend

mindspore.ops.LayerNorm

Applies the Layer Normalization to the input tensor.

Ascend GPU CPU

mindspore.ops.LogSoftmax

Log Softmax activation function.

Ascend GPU CPU

mindspore.ops.LRN

Local Response Normalization.

Ascend GPU

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

3D max pooling operation.

Ascend GPU

mindspore.ops.MaxPoolWithArgmax

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

Ascend GPU

mindspore.ops.MirrorPad

Pads the input tensor according to the paddings and mode.

Ascend GPU CPU

mindspore.ops.Mish

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

Ascend

mindspore.ops.NLLLoss

Gets the negative log likelihood loss between logits and labels.

Ascend GPU

mindspore.ops.OneHot

Computes a one-hot tensor.

Ascend GPU CPU

mindspore.ops.Pad

Pads the input tensor according to the paddings.

Ascend GPU CPU

mindspore.ops.PReLU

Parametric Rectified Linear Unit activation function.

Ascend GPU

mindspore.ops.ReLU

Computes ReLU (Rectified Linear Unit activation function) of input tensors element-wise.

Ascend GPU CPU

mindspore.ops.ReLU6

Computes ReLU (Rectified Linear Unit) upper bounded by 6 of input tensors element-wise.

Ascend GPU CPU

mindspore.ops.ReLUV2

Rectified Linear Unit activation function.

Ascend

mindspore.ops.ResizeBilinear

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

Ascend CPU GPU

mindspore.ops.RNNTLoss

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

Ascend

mindspore.ops.ROIAlign

Computes the Region of Interest (RoI) Align operator.

Ascend GPU CPU

mindspore.ops.SeLU

Computes SeLU (scaled exponential Linear Unit) of input tensors element-wise.

Ascend

mindspore.ops.SGD

Computes the stochastic gradient descent.

Ascend GPU CPU

mindspore.ops.Sigmoid

Sigmoid activation function.

Ascend GPU CPU

mindspore.ops.SigmoidCrossEntropyWithLogits

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

Ascend GPU CPU

mindspore.ops.SmoothL1Loss

Computes smooth L1 loss, a robust L1 loss.

Ascend GPU CPU

mindspore.ops.SoftMarginLoss

SoftMarginLoss operation.

Ascend

mindspore.ops.Softmax

Softmax operation.

Ascend GPU CPU

mindspore.ops.SoftmaxCrossEntropyWithLogits

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

Ascend GPU CPU

mindspore.ops.Softplus

Softplus activation function.

Ascend GPU CPU

mindspore.ops.SoftShrink

Applies the SoftShrink function element-wise.

Ascend

mindspore.ops.Softsign

Softsign activation function.

Ascend

mindspore.ops.SparseApplyAdagrad

Updates relevant entries according to the adagrad scheme.

Ascend

mindspore.ops.SparseApplyAdagradV2

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

Ascend

mindspore.ops.SparseApplyProximalAdagrad

Updates relevant entries according to the proximal adagrad algorithm.

Ascend GPU

mindspore.ops.SparseSoftmaxCrossEntropyWithLogits

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

GPU CPU

mindspore.ops.Stack

Stacks a list of tensors in specified axis.

Ascend GPU CPU

mindspore.ops.Tanh

Tanh activation function.

Ascend GPU CPU

mindspore.ops.TopK

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

Ascend GPU CPU

mindspore.ops.Unstack

Unstacks tensor in specified axis.

Ascend GPU CPU

Math Operators

API Name

Description

Supported Platforms

mindspore.ops.Abs

Returns absolute value of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.AccumulateNV2

Computes accumulation of all input tensors element-wise.

Ascend

mindspore.ops.ACos

Computes arccosine of input tensors element-wise.

Ascend GPU CPU

mindspore.ops.Add

Adds two input tensors element-wise.

Ascend GPU CPU

mindspore.ops.AddN

Computes addition of all input tensors element-wise.

Ascend GPU CPU

mindspore.ops.ApproximateEqual

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

Ascend

mindspore.ops.Asin

Computes arcsine of input tensors element-wise.

Ascend GPU CPU

mindspore.ops.Asinh

Computes inverse hyperbolic sine of the input element-wise.

Ascend GPU CPU

mindspore.ops.AssignAdd

Updates a Parameter by adding a value to it.

Ascend GPU CPU

mindspore.ops.AssignSub

Updates a Parameter by subtracting a value from it.

Ascend

mindspore.ops.Atan

Computes the trigonometric inverse tangent of the input element-wise.

Ascend GPU CPU

mindspore.ops.Atan2

Returns arctangent of x/y element-wise.

Ascend CPU GPU

mindspore.ops.Atanh

Computes inverse hyperbolic tangent of the input element-wise.

Ascend CPU

mindspore.ops.BatchMatMul

Computes matrix multiplication between two tensors by batch.

Ascend GPU CPU

mindspore.ops.BesselI0e

Computes BesselI0e of input element-wise.

Ascend

mindspore.ops.BesselI1e

Computes BesselI1e of input element-wise.

Ascend

mindspore.ops.BitwiseAnd

Returns bitwise and of two tensors element-wise.

Ascend

mindspore.ops.BitwiseOr

Returns bitwise or of two tensors element-wise.

Ascend

mindspore.ops.BitwiseXor

Returns bitwise xor of two tensors element-wise.

Ascend

mindspore.ops.Cdist

Computes batched the p-norm distance between each pair of the two collections of row vectors.

Ascend

mindspore.ops.Ceil

Rounds a tensor up to the closest integer element-wise.

Ascend

mindspore.ops.Cos

Computes cosine of input element-wise.

Ascend GPU CPU

mindspore.ops.Conj

Returns a tensor of complex numbers that are the complex conjugate of each element in input.

GPU

mindspore.ops.Cosh

Computes hyperbolic cosine of input element-wise.

Ascend CPU

mindspore.ops.CumProd

Computes the cumulative product of the tensor x along axis.

Ascend GPU

mindspore.ops.CumSum

Computes the cumulative sum of input tensor along axis.

Ascend 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

Computes a safe divide and returns 0 if the y is zero.

Ascend GPU

mindspore.ops.Eps

Creates a tensor filled with minimum value in x dtype.

Ascend GPU CPU

mindspore.ops.Equal

Computes the equivalence between two tensors element-wise.

Ascend GPU CPU

mindspore.ops.EqualCount

Computes the number of the same elements of two tensors.

GPU CPU

mindspore.ops.Erf

Computes the Gauss error function of x element-wise.

Ascend GPU

mindspore.ops.Erfc

Computes the complementary error function of x element-wise.

Ascend GPU

mindspore.ops.Erfinv

Computes the inverse error function of input.

Ascend

mindspore.ops.Exp

Returns exponential of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.Expm1

Returns exponential then minus 1 of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.FloatStatus

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

GPU

mindspore.ops.Floor

Rounds a tensor down to the closest integer element-wise.

Ascend GPU CPU

mindspore.ops.FloorDiv

Divides the first input tensor by the second input tensor element-wise and round down to the closest integer.

Ascend GPU CPU

mindspore.ops.Ger

Ger product of x1 and x2.

Ascend

mindspore.ops.Greater

Computes the boolean value of \(x > y\) element-wise.

Ascend GPU CPU

mindspore.ops.GreaterEqual

Computes the boolean value of \(x >= y\) 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

mindspore.ops.Imag

Returns a new tensor containing imaginary value of the input.

GPU

mindspore.ops.IndexAdd

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

Ascend GPU

mindspore.ops.InplaceAdd

Adds v into specified rows of x.

Ascend

mindspore.ops.InplaceSub

Subtracts v into specified rows of x.

Ascend

mindspore.ops.Inv

Computes Reciprocal of input tensor element-wise.

Ascend

mindspore.ops.Invert

Flips all bits of input tensor element-wise.

Ascend

mindspore.ops.IsInf

Determines which elements are inf or -inf for each position

GPU CPU

mindspore.ops.IsNan

Determines which elements are NaN for each position.

GPU CPU

mindspore.ops.Lerp

Does a linear interpolation of two tensors start and end based on a float or tensor weight.

Ascend

mindspore.ops.Less

Computes the boolean value of \(x < y\) element-wise.

Ascend GPU CPU

mindspore.ops.LessEqual

Computes the boolean value of \(x <= y\) element-wise.

Ascend GPU CPU

mindspore.ops.LinSpace

Returns a Tensor whose value is num evenly spaced in the interval start and stop (including start and stop), and the length of the output Tensor is num.

Ascend GPU

mindspore.ops.Log

Returns the natural logarithm of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.Log1p

Returns the natural logarithm of one plus the input tensor element-wise.

Ascend GPU

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

Returns the matrix norm or vector norm of a given tensor.

Ascend

mindspore.ops.MatMul

Multiplies matrix a and matrix b.

Ascend GPU CPU

mindspore.ops.MatrixInverse

Returns the inverse of the input matrix.

GPU CPU

mindspore.ops.Maximum

Computes the maximum of input tensors element-wise.

Ascend GPU CPU

mindspore.ops.Minimum

Computes the minimum of input tensors 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

Multiplies two tensors element-wise.

Ascend GPU CPU

mindspore.ops.MulNoNan

Computes x * y element-wise.

Ascend

mindspore.ops.Neg

Returns a tensor with negative values of the input tensor element-wise.

Ascend GPU CPU

mindspore.ops.NMSWithMask

When object detection problem is performed in the computer vision field, object detection algorithm generates a plurality of bounding boxes.

Ascend GPU CPU

mindspore.ops.NotEqual

Computes the non-equivalence of two tensors element-wise.

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

Updates the flag which is the output tensor of NPUAllocFloatStatus with the latest overflow status.

Ascend

mindspore.ops.Pow

Computes a tensor to the power of the second input.

Ascend GPU CPU

mindspore.ops.Real

Returns a Tensor that is the real part of the input.

GPU

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

mindspore.ops.ReduceAll

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

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

mindspore.ops.ReduceSum

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

Ascend GPU CPU

mindspore.ops.Round

Returns half to even of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.Rsqrt

Computes reciprocal of square root of input tensor element-wise.

Ascend GPU

mindspore.ops.Sign

Performs sign on the tensor element-wise.

Ascend CPU GPU

mindspore.ops.Sin

Computes sine of the input element-wise.

Ascend GPU CPU

mindspore.ops.Sinh

Computes hyperbolic sine of the input element-wise.

Ascend CPU

mindspore.ops.Sqrt

Returns square root of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.Square

Returns square of a tensor element-wise.

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

mindspore.ops.Sub

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

Ascend GPU CPU

mindspore.ops.Tan

Computes tangent of x element-wise.

Ascend CPU

mindspore.ops.TruncateDiv

Divides the first input tensor by the second input tensor element-wise for integer types, negative numbers will round fractional quantities towards zero.

Ascend GPU

mindspore.ops.TruncateMod

Returns the remainder of division element-wise.

Ascend GPU

mindspore.ops.Xdivy

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

Ascend

mindspore.ops.Xlogy

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

Ascend

Array Operators

API Name

Description

Supported Platforms

mindspore.ops.ApplyFtrl

Updates relevant entries according to the FTRL scheme.

Ascend GPU

mindspore.ops.Argmax

Returns the indices of the maximum value of a tensor across the axis.

Ascend GPU CPU

mindspore.ops.ArgMaxWithValue

Calculates the maximum value with the corresponding index.

Ascend GPU CPU

mindspore.ops.Argmin

Returns the indices of the minimum value of a tensor across the axis.

Ascend

mindspore.ops.ArgMinWithValue

Calculates the minimum value with corresponding index, and returns indices and values.

Ascend GPU CPU

mindspore.ops.BatchToSpace

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

Ascend GPU

mindspore.ops.BatchToSpaceND

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

Ascend

mindspore.ops.BroadcastTo

Broadcasts input tensor to a given shape.

Ascend GPU CPU

mindspore.ops.Cast

Returns a tensor with the new specified data type.

Ascend GPU CPU

mindspore.ops.Concat

Connect tensor in the specified axis.

Ascend GPU CPU

mindspore.ops.DepthToSpace

Rearrange blocks of depth data into spatial dimensions.

Ascend GPU CPU

mindspore.ops.DType

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

Ascend GPU CPU

mindspore.ops.DynamicShape

Returns the shape of the input tensor.

Ascend GPU CPU

mindspore.ops.EditDistance

Computes the Levenshtein Edit Distance.

Ascend

mindspore.ops.EmbeddingLookup

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

Ascend CPU GPU

mindspore.ops.ExpandDims

Adds an additional dimension to input_x at the given axis.

Ascend GPU CPU

mindspore.ops.ExtractVolumePatches

Extract patches from input and put them in the "depth" output dimension.

Ascend

mindspore.ops.Eye

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

Ascend GPU CPU

mindspore.ops.Fill

Creates a tensor filled with a scalar value.

Ascend GPU CPU

mindspore.ops.FusedSparseFtrl

Merges the duplicate value of the gradient and then updates relevant entries according to the FTRL-proximal scheme.

Ascend CPU

mindspore.ops.Gather

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

Ascend GPU CPU

mindspore.ops.GatherD

Gathers values along an axis specified by dim.

Ascend GPU CPU

mindspore.ops.GatherNd

Gathers slices from a tensor by indices.

Ascend GPU CPU

mindspore.ops.Identity

Returns a Tensor with the same shape and contents as input.

Ascend CPU GPU

mindspore.ops.InplaceUpdate

Updates specified rows with values in v.

Ascend

mindspore.ops.InvertPermutation

Computes the inverse of an index permutation.

Ascend GPU CPU

mindspore.ops.IsFinite

Determines which elements are finite for each position.

Ascend GPU CPU

mindspore.ops.IsInstance

Checks whether an object is an instance of a target type.

Ascend GPU CPU

mindspore.ops.IsSubClass

Checks whether this type is a sub-class of another type.

Ascend GPU CPU

mindspore.ops.MaskedFill

Fills elements of self tensor with value where mask is True.

Ascend

mindspore.ops.MaskedSelect

Returns a new 1-D Tensor which indexes the input tensor according to the boolean mask.

Ascend CPU

mindspore.ops.Meshgrid

Generates coordinate matrices from given coordinate tensors.

Ascend GPU

mindspore.ops.Ones

Creates a tensor filled with value ones.

Ascend GPU CPU

mindspore.ops.OnesLike

Creates a new tensor.

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

mindspore.ops.ParallelConcat

Concats tensor in the first dimension.

Ascend

mindspore.ops.Randperm

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

Ascend GPU

mindspore.ops.Rank

Returns the rank of a tensor.

Ascend GPU CPU

mindspore.ops.Reshape

Reshapes the input tensor with the same values based on a given shape tuple.

Ascend GPU CPU

mindspore.ops.ResizeNearestNeighbor

Resizes the input tensor by using the nearest neighbor algorithm.

Ascend GPU CPU

mindspore.ops.ReverseSequence

Reverses variable length slices.

Ascend GPU

mindspore.ops.ReverseV2

Reverses specific dimensions of a tensor.

Ascend GPU

mindspore.ops.Rint

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

Ascend GPU CPU

mindspore.ops.SameTypeShape

Checks whether the data type and shape of two tensors are the same.

Ascend GPU CPU

mindspore.ops.ScalarCast

Casts the input scalar to another type.

Ascend GPU CPU

mindspore.ops.ScalarToArray

Converts a scalar to a Tensor.

Ascend GPU CPU

mindspore.ops.ScalarToTensor

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

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 CPU

mindspore.ops.ScatterMax

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

Ascend CPU

mindspore.ops.ScatterMin

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

Ascend CPU

mindspore.ops.ScatterMul

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

Ascend CPU

mindspore.ops.ScatterNd

Scatters a tensor into a new tensor depending on the specified indices.

Ascend GPU CPU

mindspore.ops.ScatterNdAdd

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

Ascend GPU

mindspore.ops.ScatterNdSub

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

Ascend GPU

mindspore.ops.ScatterNdUpdate

Updates tensor values by using input indices and value.

Ascend GPU CPU

mindspore.ops.ScatterNonAliasingAdd

Applies sparse addition to the input using individual values or slices.

Ascend

mindspore.ops.ScatterSub

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

Ascend CPU GPU

mindspore.ops.ScatterUpdate

Updates tensor values by using input indices and value.

Ascend GPU CPU

mindspore.ops.Select

Returns the selected elements, either from input \(x\) or input \(y\), depending on the condition.

Ascend GPU CPU

mindspore.ops.Shape

Returns the shape of the input tensor.

Ascend GPU CPU

mindspore.ops.Size

Returns the size of a 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 a given dimension in ascending order by value.

Ascend GPU CPU

mindspore.ops.SpaceToBatch

SpaceToBatch is deprecated.

Deprecated

mindspore.ops.SpaceToBatchND

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

Ascend

mindspore.ops.SpaceToDepth

Rearrange blocks of spatial data into depth.

Ascend GPU CPU

mindspore.ops.SparseApplyFtrl

Updates relevant entries according to the FTRL-proximal scheme.

Ascend GPU

mindspore.ops.SparseApplyFtrlV2

Updates relevant entries according to the FTRL-proximal scheme.

Ascend

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

Splits the input tensor into num_split tensors along the given dimension.

Ascend

mindspore.ops.Squeeze

Returns a tensor with the same data type but dimensions of 1 are removed based on axis.

Ascend GPU CPU

mindspore.ops.StridedSlice

Extracts a strided slice of a tensor.

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.

GPU

mindspore.ops.TensorScatterMax

By comparing the value at the position indicated by the index in input_x with the value in the update, the value at the index will eventually be equal to the largest one to create a new tensor.

GPU

mindspore.ops.TensorScatterMin

By comparing the value at the position indicated by the index 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.

GPU

mindspore.ops.TensorScatterSub

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

GPU

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

Replicates a tensor with given multiples times.

Ascend GPU CPU

mindspore.ops.Transpose

Permutes the dimensions of the input tensor according to input permutation.

Ascend GPU CPU

mindspore.ops.TupleToArray

Converts a tuple to a 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.UniqueWithPad

Returns unique elements and relative indexes in 1-D tensor, filled with padding num.

Ascend CPU

mindspore.ops.UnsortedSegmentMax

Computes the maximum along segments of a tensor.

Ascend GPU

mindspore.ops.UnsortedSegmentMin

Computes the minimum of a tensor along segments.

Ascend GPU

mindspore.ops.UnsortedSegmentProd

Computes the product of a tensor along segments.

Ascend

mindspore.ops.UnsortedSegmentSum

Computes the sum of a tensor along segments.

Ascend GPU CPU

mindspore.ops.Zeros

Creates a tensor filled with value zeros.

Ascend GPU CPU

mindspore.ops.ZerosLike

Creates a new tensor.

Ascend GPU CPU

Communication Operators

Note that the APIs in the following list need to preset communication environment variables. For the Ascend devices, users need to prepare the rank table, set rank_id and device_id. Please see the Ascend tutorial for more details. For the GPU device, users need to prepare the host file and mpi, please see the GPU tutorial .

API Name

Description

Supported Platforms

mindspore.ops.AllGather

Gathers tensors from the specified communication group.

Ascend GPU

mindspore.ops.AllReduce

Reduces the tensor data across all devices in such a way that all devices will get the same final result.

Ascend GPU

mindspore.ops.AlltoAll

AlltoAll is a collective operation.

Ascend

mindspore.ops.Broadcast

Broadcasts the tensor to the whole group.

Ascend GPU

mindspore.ops.NeighborExchange

NeighborExchange is a collective operation.

Ascend

mindspore.ops.NeighborExchangeV2

NeighborExchangeV2 is a collective operation.

Ascend

mindspore.ops.ReduceOp

Operation options for reducing tensors.

Ascend GPU

mindspore.ops.ReduceScatter

Reduces and scatters tensors from the specified communication group.

Ascend GPU

Debug Operators

API Name

Description

Supported Platforms

mindspore.ops.HistogramSummary

Outputs the tensor to protocol buffer through histogram summary operator.

Ascend GPU CPU

mindspore.ops.HookBackward

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

Ascend GPU CPU

mindspore.ops.ImageSummary

Outputs the image tensor to protocol buffer through image summary operator.

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

Outputs the tensor or string to stdout.

Ascend GPU

mindspore.ops.ScalarSummary

Outputs a scalar to a protocol buffer through a scalar summary operator.

Ascend GPU CPU

mindspore.ops.TensorSummary

Outputs a tensor to a protocol buffer through a tensor summary operator.

Ascend GPU CPU

Random Operators

API Name

Description

Supported Platforms

mindspore.ops.Gamma

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

Ascend

mindspore.ops.LogUniformCandidateSampler

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

Ascend

mindspore.ops.Multinomial

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

GPU

mindspore.ops.Poisson

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

Ascend

mindspore.ops.RandomCategorical

Generates random samples from a given categorical distribution tensor.

Ascend GPU

mindspore.ops.RandomChoiceWithMask

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

Ascend GPU CPU

mindspore.ops.StandardLaplace

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

Ascend

mindspore.ops.StandardNormal

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

Ascend GPU CPU

mindspore.ops.UniformCandidateSampler

Uniform candidate sampler.

GPU

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 i, uniformly distributed to the interval [0, 1).

Ascend GPU CPU

Image Operators

API Name

Description

Supported Platforms

mindspore.ops.CropAndResize

Extracts crops from the input image tensor and resizes them.

Ascend GPU CPU

Sparse Operators

API Name

Description

Supported Platforms

mindspore.ops.SparseToDense

Converts a sparse representation into a dense tensor.

CPU

mindspore.ops.SparseTensorDenseMatmul

Multiplies sparse matrix A by dense matrix B.

CPU

Custom Operators

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

Other Operators

API Name

Description

Supported Platforms

mindspore.ops.Assign

Assigns Parameter with a value.

Ascend GPU CPU

mindspore.ops.BoundingBoxDecode

Decodes bounding boxes locations.

Ascend GPU CPU

mindspore.ops.BoundingBoxEncode

Encodes bounding boxes locations.

Ascend GPU CPU

mindspore.ops.CheckBprop

Checks whether the data type and the shape of corresponding elements from tuples x and y are the same.

Ascend GPU CPU

mindspore.ops.CheckValid

Checks bounding box.

Ascend GPU CPU

mindspore.ops.Depend

Depend is used for processing dependency operations.

Ascend GPU CPU

mindspore.ops.InTopK

Determines whether the targets are in the top k predictions.

Ascend GPU

mindspore.ops.IOU

Calculates intersection over union for boxes.

Ascend GPU CPU

mindspore.ops.NoRepeatNGram

Updates log_probs with repeat n-grams.

Ascend

mindspore.ops.Partial

Makes a partial function instance.

Ascend GPU CPU

mindspore.ops.PopulationCount

Calculates population count.

Ascend

composite

The composite operators are the pre-defined combination of operators.

API Name

Description

Supported Platforms

mindspore.ops.batch_dot

Computation of batch dot product between samples in two tensors containing batch dims.

Ascend GPU CPU

mindspore.ops.clip_by_global_norm

Clips tensor values by the ratio of the sum of their norms.

Ascend GPU CPU

mindspore.ops.clip_by_value

Clips tensor values to a specified min and max.

Ascend GPU CPU

mindspore.ops.core

A decorator that adds a flag to the function.

Ascend GPU CPU

mindspore.ops.count_nonzero

Count number of nonzero elements across axis of input tensor

Ascend GPU CPU

mindspore.ops.cummin

Computation of the cumulative minimum of elements of 'x' in the dimension axis, and the index location of each maximum value found in the dimension 'axis'.

Ascend

mindspore.ops.dot

Computation a dot product between samples in two tensors.

Ascend GPU CPU

mindspore.ops.gamma

Generates random numbers according to the Gamma random number distribution.

Ascend

mindspore.ops.GradOperation

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

Ascend GPU CPU

mindspore.ops.HyperMap

Hypermap will apply the set operation to input sequences.

Ascend GPU CPU

mindspore.ops.laplace

Generates random numbers according to the Laplace random number distribution.

Ascend

mindspore.ops.Map

Map will apply the set operation on input sequences.

Ascend GPU CPU

mindspore.ops.matmul

Returns the matrix product of two arrays.

Ascend GPU CPU

mindspore.ops.multinomial

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

GPU

mindspore.ops.MultitypeFuncGraph

Generates overloaded functions.

Ascend GPU CPU

mindspore.ops.normal

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

Ascend GPU CPU

mindspore.ops.poisson

Generates random numbers according to the Poisson random number distribution.

Ascend

mindspore.ops.repeat_elements

Repeat elements of a tensor along an axis, like np.repeat.

Ascend GPU CPU

mindspore.ops.sequence_mask

Returns a mask tensor representing the first N positions of each cell.

GPU

mindspore.ops.tensor_dot

Computation of Tensor contraction on arbitrary axes between tensors a and b.

Ascend GPU CPU

mindspore.ops.uniform

Generates random numbers according to the Uniform random number distribution.

Ascend GPU

functional

The functional operators are the pre-instantiated Primitive operators, which can be used directly as a function. The use cases of some functional operators are as follows:

from mindspore import Tensor, ops
from mindspore import dtype as mstype

input_x = Tensor(-1, mstype.int32)
input_dict = {'x':1, 'y':2}

result_abs = ops.absolute(input_x)
print(result_abs)

result_in_dict = ops.in_dict('x', input_dict)
print(result_in_dict)

result_not_in_dict = ops.not_in_dict('x', input_dict)
print(result_not_in_dict)

result_isconstant = ops.isconstant(input_x)
print(result_isconstant)

result_typeof = ops.typeof(input_x)
print(result_typeof)

# outputs:
# 1
# True
# False
# True
# Tensor[Int32]

functional

Description

mindspore.ops.absolute

Refer to mindspore.ops.Abs.

mindspore.ops.acos

Refer to mindspore.ops.ACos.

mindspore.ops.acosh

Refer to mindspore.ops.Acosh.

mindspore.ops.add

Refer to mindspore.ops.Add.

mindspore.ops.addn

Refer to mindspore.ops.AddN.

mindspore.ops.asin

Refer to mindspore.ops.Asin.

mindspore.ops.asinh

Refer to mindspore.ops.Asinh.

mindspore.ops.assign

Refer to mindspore.ops.Assign.

mindspore.ops.assign_add

Refer to mindspore.ops.AssignAdd.

mindspore.ops.assign_sub

Refer to mindspore.ops.AssignSub.

mindspore.ops.atan

Refer to mindspore.ops.Atan.

mindspore.ops.atan2

Refer to mindspore.ops.Atan2.

mindspore.ops.atanh

Refer to mindspore.ops.Atanh.

mindspore.ops.bitwise_and

Refer to mindspore.ops.BitwiseAnd.

mindspore.ops.bitwise_or

Refer to mindspore.ops.BitwiseOr.

mindspore.ops.bitwise_xor

Refer to mindspore.ops.BitwiseXor.

mindspore.ops.bool_and

Calculate the result of logical AND operation. (Usage is the same as “and” in Python)

mindspore.ops.bool_eq

Determine whether the Boolean values are equal. (Usage is the same as “==” in Python)

mindspore.ops.bool_not

Calculate the result of logical NOT operation. (Usage is the same as “not” in Python)

mindspore.ops.bool_or

Calculate the result of logical OR operation. (Usage is the same as “or” in Python)

mindspore.ops.cast

Refer to mindspore.ops.Cast.

mindspore.ops.cos

Refer to mindspore.ops.Cos.

mindspore.ops.cosh

Refer to mindspore.ops.Cosh.

mindspore.ops.cumprod

Refer to mindspore.ops.CumProd.

mindspore.ops.cumsum

Refer to mindspore.ops.CumSum.

mindspore.ops.div

Refer to mindspore.ops.RealDiv.

mindspore.ops.depend

Refer to mindspore.ops.Depend.

mindspore.ops.dtype

Refer to mindspore.ops.DType.

mindspore.ops.erf

Refer to mindspore.ops.Erf.

mindspore.ops.erfc

Refer to mindspore.ops.Erfc.

mindspore.ops.eye

Refer to mindspore.ops.Eye.

mindspore.ops.equal

Refer to mindspore.ops.Equal.

mindspore.ops.expand_dims

Refer to mindspore.ops.ExpandDims.

mindspore.ops.exp

Refer to mindspore.ops.Exp.

mindspore.ops.fill

Refer to mindspore.ops.Fill.

mindspore.ops.floor

Refer to mindspore.ops.Floor.

mindspore.ops.floordiv

Refer to mindspore.ops.FloorDiv.

mindspore.ops.floormod

Refer to mindspore.ops.FloorMod.

mindspore.ops.gather

Refer to mindspore.ops.Gather.

mindspore.ops.gather_d

Refer to mindspore.ops.GatherD.

mindspore.ops.gather_nd

Refer to mindspore.ops.GatherNd.

mindspore.ops.ge

Refer to mindspore.ops.GreaterEqual.

mindspore.ops.gt

Refer to mindspore.ops.Greater.

mindspore.ops.invert

Refer to mindspore.ops.Invert.

mindspore.ops.in_dict

Determine if a str in dict.

mindspore.ops.is_not

Determine whether the input is not the same as the other one. (Usage is the same as “is not” in Python)

mindspore.ops.is_

Determine whether the input is the same as the other one. (Usage is the same as “is” in Python)

mindspore.ops.isconstant

Determine whether the object is constant.

mindspore.ops.isfinite

Refer to mindspore.ops.IsFinite.

mindspore.ops.isinstance_

Refer to mindspore.ops.IsInstance.

mindspore.ops.isnan

Refer to mindspore.ops.IsNan.

mindspore.ops.issubclass_

Refer to mindspore.ops.IsSubClass.

mindspore.ops.log

Refer to mindspore.ops.Log.

mindspore.ops.logical_and

Refer to mindspore.ops.LogicalAnd.

mindspore.ops.le

Refer to mindspore.ops.LessEqual.

mindspore.ops.less

Refer to mindspore.ops.Less.

mindspore.ops.logical_and

Refer to mindspore.ops.LogicalAnd.

mindspore.ops.logical_not

Refer to mindspore.ops.LogicalNot.

mindspore.ops.logical_or

Refer to mindspore.ops.LogicalOr.

mindspore.ops.maximum

Refer to mindspore.ops.Maximum.

mindspore.ops.minimum

Refer to mindspore.ops.Minimum.

mindspore.ops.mul

Refer to mindspore.ops.Mul.

mindspore.ops.neg_tensor

Refer to mindspore.ops.Neg.

mindspore.ops.not_equal

Refer to mindspore.ops.NotEqual.

mindspore.ops.not_in_dict

Determine whether the object is not in the dict.

mindspore.ops.ones_like

Refer to mindspore.ops.OnesLike.

mindspore.ops.partial

Refer to mindspore.ops.Partial.

mindspore.ops.pows

Refer to mindspore.ops.Pow.

mindspore.ops.print_

Refer to mindspore.ops.Print.

mindspore.ops.rank

Refer to mindspore.ops.Rank.

mindspore.ops.reduce_max

Refer to mindspore.ops.ReduceMax.

mindspore.ops.reduce_mean

Refer to mindspore.ops.ReduceMean.

mindspore.ops.reduce_min

Refer to mindspore.ops.ReduceMin.

mindspore.ops.reduce_prod

Refer to mindspore.ops.ReduceProd.

mindspore.ops.reduce_sum

Refer to mindspore.ops.ReduceSum.

mindspore.ops.reshape

Refer to mindspore.ops.Reshape.

mindspore.ops.same_type_shape

Refer to mindspore.ops.SameTypeShape.

mindspore.ops.scalar_add

Get the sum of two numbers. (Usage is the same as “+” in Python)

mindspore.ops.scalar_cast

Refer to mindspore.ops.ScalarCast.

mindspore.ops.check_bprop

Refer to mindspore.ops.CheckBprop.

mindspore.ops.scalar_div

Get the quotient of dividing the first input number by the second input number. (Usage is the same as “/” in Python)

mindspore.ops.scalar_eq

Determine whether two numbers are equal. (Usage is the same as “==” in Python)

mindspore.ops.scalar_floordiv

Divide the first input number by the second input number and round down to the closest integer. (Usage is the same as “//” in Python)

mindspore.ops.scalar_ge

Determine whether the number is greater than or equal to another number. (Usage is the same as “>=” in Python)

mindspore.ops.scalar_gt

Determine whether the number is greater than another number. (Usage is the same as “>” in Python)

mindspore.ops.scalar_le

Determine whether the number is less than or equal to another number. (Usage is the same as “<=” in Python)

mindspore.ops.scalar_log

Get the natural logarithm of the input number.

mindspore.ops.scalar_lt

Determine whether the number is less than another number. (Usage is the same as “<” in Python)

mindspore.ops.scalar_mod

Get the remainder of dividing the first input number by the second input number. (Usage is the same as “%” in Python)

mindspore.ops.scalar_mul

Get the product of the input two numbers. (Usage is the same as “*” in Python)

mindspore.ops.scalar_ne

Determine whether two numbers are not equal. (Usage is the same as “!=” in Python)

mindspore.ops.scalar_pow

Compute a number to the power of the second input number.

mindspore.ops.scalar_sub

Subtract the second input number from the first input number. (Usage is the same as “-” in Python)

mindspore.ops.scalar_to_array

Refer to mindspore.ops.ScalarToArray.

mindspore.ops.scalar_to_tensor

Refer to mindspore.ops.ScalarToTensor.

mindspore.ops.scalar_uadd

Get the positive value of the input number.

mindspore.ops.scalar_usub

Get the negative value of the input number.

mindspore.ops.scatter_nd

Refer to mindspore.ops.ScatterNd.

mindspore.ops.scatter_nd_update

Refer to mindspore.ops.ScatterNdUpdate.

mindspore.ops.scatter_update

Refer to mindspore.ops.ScatterUpdate.

mindspore.ops.shape

Refer to mindspore.ops.Shape.

mindspore.ops.shape_mul

The input of shape_mul must be shape multiply elements in tuple(shape).

mindspore.ops.sin

Refer to mindspore.ops.Sin.

mindspore.ops.sinh

Refer to mindspore.ops.Sinh.

mindspore.ops.size

Refer to mindspore.ops.Size.

mindspore.ops.sort

Refer to mindspore.ops.Sort.

mindspore.ops.sqrt

Refer to mindspore.ops.Sqrt.

mindspore.ops.square

Refer to mindspore.ops.Square.

mindspore.ops.squeeze

Refer to mindspore.ops.Squeeze.

mindspore.ops.stack

Refer to mindspore.ops.Stack.

mindspore.ops.stop_gradient

Disable update during back propagation. (stop_gradient)

mindspore.ops.strided_slice

Refer to mindspore.ops.StridedSlice.

mindspore.ops.string_concat

Concatenate two strings.

mindspore.ops.string_eq

Determine if two strings are equal.

mindspore.ops.sub

Refer to mindspore.ops.Sub.

mindspore.ops.tan

Refer to mindspore.ops.Tan.

mindspore.ops.tanh

Refer to mindspore.ops.Tanh.

mindspore.ops.tensor_add

Refer to mindspore.ops.Add.

mindspore.ops.tensor_div

Refer to mindspore.ops.RealDiv.

mindspore.ops.tensor_exp

Refer to mindspore.ops.Exp.

mindspore.ops.tensor_expm1

Refer to mindspore.ops.Expm1.

mindspore.ops.tensor_floordiv

Refer to mindspore.ops.FloorDiv.

mindspore.ops.tensor_ge

Refer to mindspore.ops.GreaterEqual.

mindspore.ops.tensor_gt

Refer to mindspore.ops.Greater.

mindspore.ops.tensor_le

Refer to mindspore.ops.LessEqual.

mindspore.ops.tensor_lt

Refer to mindspore.ops.Less.

mindspore.ops.tensor_mod

Refer to mindspore.ops.FloorMod.

mindspore.ops.tensor_mul

Refer to mindspore.ops.Mul.

mindspore.ops.tensor_pow

Refer to mindspore.ops.Pow.

mindspore.ops.tensor_scatter_add

Refer to mindspore.ops.TensorScatterAdd.

mindspore.ops.tensor_scatter_update

Refer to mindspore.ops.TensorScatterUpdate.

mindspore.ops.tensor_slice

Refer to mindspore.ops.Slice.

mindspore.ops.tensor_sub

Refer to mindspore.ops.Sub.

mindspore.ops.tile

Refer to mindspore.ops.Tile.

mindspore.ops.transpose

Refer to mindspore.ops.Transpose.

mindspore.ops.tuple_to_array

Refer to mindspore.ops.TupleToArray.

mindspore.ops.typeof

Get type of object.

mindspore.ops.zeros_like

Refer to mindspore.ops.ZerosLike.

API Name

Description

Supported Platforms

mindspore.ops.grad

A wrapper function to generate the gradient function for the input function.

Ascend GPU CPU

mindspore.ops.jvp

Compute the jacobian-vector-product of the given network.

Ascend GPU CPU

mindspore.ops.narrow

Returns a narrowed tensor from input tensor.

Ascend GPU CPU

mindspore.ops.select

Returns the selected elements, either from input \(x\) or input \(y\), depending on the condition cond.

Ascend GPU CPU

mindspore.ops.vjp

Compute the vector-jacobian-product of the given network.

Ascend GPU CPU

primitive

mindspore.ops.constexpr

Creates a PrimitiveWithInfer operator that can infer the value at compile time.

mindspore.ops.prim_attr_register

Primitive attributes register.

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 defines functions for checking operator input arguments but used 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.

vm_impl_registry

mindspore.ops.get_vm_impl_fn

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

op_info_register

mindspore.ops.AiCPURegOp

Class for AiCPU operator information register.

mindspore.ops.custom_info_register

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

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

A decorator which is used to register an operator.

mindspore.ops.TBERegOp

Class for TBE operator information register.