mindspore.ops

mindspore.ops provides a large number of function interfaces, including neural network functions, mathematical operation functions, Tensor operation functions, Parameter operation functions, differential functions and so on.

For more information about dynamic shape support status, please refer to Dynamic Shape Support Status of ops Interface .

The module import method is as follows:

from mindspore import 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 mindspore.ops API Interface Change.

Neural Network Layer Functions

Neural Network

API Name

Description

Supported Platforms

Warning

mindspore.ops.adaptive_avg_pool1d

Applies a 1D adaptive average pooling over an input Tensor which can be regarded as a composition of 1D input planes.

Ascend GPU CPU

None

mindspore.ops.adaptive_avg_pool2d

Performs 2D adaptive average pooling on a multi-plane input signal.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.adaptive_avg_pool3d

Performs 3D adaptive average pooling on a multi-plane input signal.

Ascend GPU CPU

None

mindspore.ops.adaptive_max_pool1d

Applies a 1D adaptive maximum pooling over an input Tensor which can be regarded as a composition of 1D input planes.

Ascend GPU CPU

None

mindspore.ops.adaptive_max_pool2d

This operator applies a 2D adaptive max pooling to an input signal composed of multiple input planes.

Ascend GPU CPU

None

mindspore.ops.avg_pool1d

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

Ascend GPU CPU

kernel_size is in the range [1, 255]. stride is in the range [1, 63].

mindspore.ops.avg_pool2d

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

Ascend GPU CPU

kernel_size is in the range [1, 255]. stride is in the range [1, 63].

mindspore.ops.avg_pool3d

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

Ascend GPU CPU

kernel_size is in the range [1, 255]. stride is in the range [1, 63].

mindspore.ops.batch_norm

Batch Normalization for input data and updated parameters.

Ascend GPU CPU

For Atlas 200/300/500 inference product, the result accuracy fails to reach 1‰ due to the square root instruction.

mindspore.ops.bias_add

Returns the sum of the input_x and the bias Tensor.

Ascend GPU CPU

None

mindspore.ops.bidense

Applies bilinear dense connected layer for input1 and input2.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.ctc_greedy_decoder

Performs greedy decoding on the logits given in inputs.

Ascend GPU CPU

None

mindspore.ops.conv1d

Applies a 1D convolution over an input tensor.

Ascend GPU

None

mindspore.ops.conv2d

Applies a 2D convolution over an input tensor.

Ascend GPU

None

mindspore.ops.conv3d

Applies a 3D convolution over an input tensor.

Ascend GPU

None

mindspore.ops.deformable_conv2d

Given 4D tensor inputs x, weight and offsets, compute a 2D deformable convolution.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.dense

Applies the dense connected operation to the input.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion. On the Ascend platform, if bias is not 1D, the input cannot be greater than 6D in PYNATIVE or KBK mode.

mindspore.ops.dropout

During training, randomly zeroes some of the elements of the input tensor with probability p from a Bernoulli distribution.

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.dropout1d

During training, randomly zeroes some channels of the input tensor with probability p from a Bernoulli distribution(For a 3-dimensional tensor with a shape of NCL, the channel feature map refers to a 1-dimensional feature map with the shape of L).

Ascend GPU CPU

None

mindspore.ops.dropout2d

During training, randomly zeroes some channels of the input tensor with probability p from a Bernoulli distribution(For a 4-dimensional tensor with a shape of NCHW, the channel feature map refers to a 2-dimensional feature map with the shape of HW).

Ascend GPU CPU

None

mindspore.ops.dropout3d

During training, randomly zeroes some channels of the input tensor with probability p from a Bernoulli distribution(For a 5-dimensional tensor with a shape of NCDHW, the channel feature map refers to a 3-dimensional feature map with a shape of DHW).

Ascend GPU CPU

None

mindspore.ops.embedding

Retrieve the word embeddings in weight using indices specified in input.

Ascend

On Ascend, the behavior is unpredictable when the value of input is invalid.

mindspore.ops.flatten

Flatten a tensor along dimensions from start_dim to start_dim.

Ascend GPU CPU

None

mindspore.ops.fold

Combines an array of sliding local blocks into a large containing tensor.

Ascend GPU CPU

The input must be a 3-dimensional Tensor with shape (N,C×(kernel_size),L) . The output must be a 4-dimensional Tensor with shape (N,C,output_size[0],output_size[1],...) .

mindspore.ops.fractional_max_pool3d

Applies the 3D FractionalMaxPool operation over input.

GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.fused_infer_attention_score

This is a FlashAttention function designed for both incremental and full inference scenarios.

Ascend

This is an experimental API that is subject to change or deletion. For Ascend, only the Atlas A2 training series products and Atlas 800I A2 inference products are currently supported.

mindspore.ops.speed_fusion_attention

The interface is used for self-attention fusion computing.

Ascend

This is an experimental API that is subject to change or deletion. Only support on Atlas A2 training series.

mindspore.ops.group_norm

Group Normalization over a mini-batch of inputs.

Ascend GPU CPU

None

mindspore.ops.layer_norm

Applies the Layer Normalization on the mini-batch input.

Ascend

None

mindspore.ops.lp_pool1d

Applying 1D LPPooling operation on an input Tensor can be regarded as forming a 1D input plane.

Ascend GPU CPU

None

mindspore.ops.lp_pool2d

Applying 2D LPPooling operation on an input Tensor can be regarded as forming a 2D input plane.

Ascend GPU CPU

None

mindspore.ops.lrn

Local Response Normalization.

GPU CPU

lrn is deprecated on Ascend due to potential accuracy problem. It's recommended to use other normalization methods, e.g. mindspore.ops.batch_norm.

mindspore.ops.max_pool2d

Performs a 2D max pooling on the input Tensor.

Ascend GPU CPU

None

mindspore.ops.max_pool3d

Performs a 3D max pooling on the input Tensor.

Ascend GPU CPU

None

mindspore.ops.max_unpool1d

Computes the inverse of max_pool1d.

Ascend GPU CPU

None

mindspore.ops.max_unpool2d

Computes the inverse of max_pool2d.

Ascend GPU CPU

None

mindspore.ops.max_unpool3d

Computes the inverse of mindspore.ops.max_pool3d().

Ascend GPU CPU

None

mindspore.ops.moe_token_permute

Permute the tokens based on the indices.

Ascend

It is only supported on Atlas A2 Training Series Products. The input tokens only supports the bfloat16 data type in the current version. When indices is 2-D, the size of the second dim must be less than or equal to 512.

mindspore.ops.moe_token_unpermute

Unpermute a tensor of permuted tokens based on sorted indices, and optionally merge the tokens with their corresponding probabilities.

Ascend

It is only supported on Atlas A2 Training Series Products. The inputs permuted_tokens and probs only support the bfloat16 data type in the current version. sorted_indices must not have duplicate values, otherwise the result is undefined.

mindspore.ops.incre_flash_attention

The interface for incremental inference.

Ascend

Only support on Atlas A2 training series.

mindspore.ops.prompt_flash_attention

The interface for fully inference.

Ascend

Support dtype of float16 for attn_mask will be deprecated in the future. When sparse_mode is 2, 3 or 4, the shape of attn_mask must be (2048,2048) / (B,1,2048,2048) / (1,1,2048,2048).

mindspore.ops.flash_attention_score

Implement self-attention calculations in training scenarios.

Ascend

This is an experimental API that is subject to change or deletion. Only support on Atlas A2 training series.

mindspore.ops.rms_norm

The RmsNorm(Root Mean Square Layer Normalization) operator is a normalization operation.

Ascend

This is an experimental API that is subject to change or deletion. This API is only supported in Atlas A2 training series for now.

mindspore.ops.unfold

Extracts sliding local blocks from a batched input tensor.

Ascend GPU CPU

The output is a 3-dimensional Tensor whose shape is (N,C×(kernel_size),L) . This is an experimental API that is subject to change or deletion.

Loss Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.binary_cross_entropy

Computes the binary cross entropy(Measure the difference information between two probability distributions) between predictive value logits and target value labels.

Ascend GPU CPU

The value of logits must range from 0 to l.

mindspore.ops.binary_cross_entropy_with_logits

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

Ascend GPU CPU

None

mindspore.ops.cosine_embedding_loss

CosineEmbeddingLoss creates a criterion to measure the similarity between two tensors using cosine distance.

Ascend GPU CPU

None

mindspore.ops.cross_entropy

The cross entropy loss between input and target.

Ascend GPU CPU

None

mindspore.ops.ctc_loss

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

Ascend GPU CPU

None

mindspore.ops.gaussian_nll_loss

Gaussian negative log likelihood loss.

Ascend GPU CPU

None

mindspore.ops.hinge_embedding_loss

Measures Hinge Embedding Loss given an input Tensor intputs and a labels Tensor targets (containing 1 or -1).

Ascend GPU CPU

None

mindspore.ops.huber_loss

Calculates the error between the predicted value and the target value, which has the best of both the loss of mindspore.ops.l1_loss() and the loss of mindspore.ops.mse_loss().

Ascend GPU CPU

None

mindspore.ops.kl_div

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

Ascend GPU CPU

None

mindspore.ops.l1_loss

Calculate the mean absolute error between the input value and the target value.

Ascend GPU CPU

None

mindspore.ops.margin_ranking_loss

MarginRankingLoss creates a criterion that measures the loss.

Ascend GPU CPU

None

mindspore.ops.mse_loss

Calculates the mean squared error between the predicted value and the label value.

Ascend GPU CPU

None

mindspore.ops.multi_margin_loss

Hinge loss for optimizing a multi-class classification.

Ascend GPU CPU

None

mindspore.ops.multilabel_margin_loss

Hinge loss for optimizing a multi-label classification.

Ascend GPU

None

mindspore.ops.multilabel_soft_margin_loss

Calculates the MultiLabelSoftMarginLoss.

Ascend GPU CPU

None

mindspore.ops.nll_loss

Gets the negative log likelihood loss between inputs and target.

Ascend GPU CPU

None

mindspore.ops.smooth_l1_loss

Computes smooth L1 loss, a robust L1 loss.

Ascend GPU CPU

This API has poor performance on CPU and it is recommended to run it on the Ascend/GPU.

mindspore.ops.soft_margin_loss

Calculate the soft margin loss of input and target.

Ascend GPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.triplet_margin_loss

TripletMarginLoss operation.

GPU

None

Activation Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.celu

celu activation function, computes celu (Continuously differentiable exponential linear units) of input tensors element-wise.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.elu

Exponential Linear Unit activation function.

Ascend GPU CPU

None

mindspore.ops.fast_gelu

Fast Gaussian Error Linear Units activation function.

Ascend GPU CPU

None

mindspore.ops.gelu

Gaussian Error Linear Units activation function.

Ascend GPU CPU

None

mindspore.ops.glu

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

Ascend GPU CPU

None

mindspore.ops.gumbel_softmax

Returns the samples from the Gumbel-Softmax distribution and optionally discretizes.

Ascend GPU CPU

None

mindspore.ops.hardshrink

Hard Shrink activation function.

Ascend GPU CPU

None

mindspore.ops.hardsigmoid

Hard Sigmoid activation function.

Ascend GPU CPU

None

mindspore.ops.hardswish

Hard Swish activation function.

Ascend GPU CPU

None

mindspore.ops.hardtanh

Applies the hardtanh activation function element-wise.

Ascend GPU CPU

None

mindspore.ops.leaky_relu

leaky_relu activation function.

Ascend GPU CPU

None

mindspore.ops.log_softmax

Applies the Log Softmax function to the input tensor on the specified axis.

Ascend GPU CPU

None

mindspore.ops.logsigmoid

Applies LogSigmoid activation element-wise.

Ascend GPU CPU

None

mindspore.ops.mish

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

Ascend GPU CPU

None

mindspore.ops.prelu

Parametric Rectified Linear Unit activation function.

Ascend GPU CPU

None

mindspore.ops.relu

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

Ascend GPU CPU

None

mindspore.ops.relu6

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

Ascend GPU CPU

None

mindspore.ops.rrelu

Randomized Leaky ReLU activation function.

Ascend GPU CPU

None

mindspore.ops.selu

Activation function SeLU (Scaled exponential Linear Unit).

Ascend GPU CPU

None

mindspore.ops.sigmoid

Computes Sigmoid of input element-wise.

Ascend GPU CPU

None

mindspore.ops.silu

Computes Sigmoid Linear Unit of input element-wise, also known as Swish function.

Ascend GPU CPU

None

mindspore.ops.softmax

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

Ascend GPU CPU

None

mindspore.ops.softmin

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

Ascend GPU CPU

None

mindspore.ops.softshrink

Soft Shrink activation function.

Ascend GPU CPU

None

mindspore.ops.softsign

SoftSign activation function.

Ascend GPU CPU

None

mindspore.ops.swiglu

Computes SwiGLU (Swish-Gated Linear Unit activation function) of input tensor.

Ascend

This is an experimental API that is subject to change or deletion.

mindspore.ops.tanh

Computes hyperbolic tangent of input element-wise.

Ascend GPU CPU

None

mindspore.ops.threshold

Returns each element of input after thresholding by thr as a Tensor.

Ascend GPU CPU

None

Distance Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.cdist

Computes p-norm distance between each pair of row vectors of two input Tensors.

Ascend GPU CPU

None

mindspore.ops.dist

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

Ascend GPU CPU

None

mindspore.ops.pdist

Calculates the distance between every pair of row vectors in the input using the p-norm.

GPU CPU

None

Sampling Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.choice_with_mask

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

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.random_categorical

Generates random samples from a given categorical distribution tensor.

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.log_uniform_candidate_sampler

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

Ascend CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.uniform_candidate_sampler

Uniform candidate sampler.

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect. The Ascend backend does not support dynamic shape scenarios currently.

Image Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.affine_grid

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

Ascend GPU CPU

None

mindspore.ops.bounding_box_decode

Decode the bounding box locations, calculate the offset, and convert the offset into a Bbox, which is used to mark the target in the subsequent images, etc.

Ascend GPU CPU

None

mindspore.ops.bounding_box_encode

Encode the bounding box locations, calculate the offset between the predicted bounding boxes and the real bounding boxes, and the offset will be used as a variable for the loss.

Ascend GPU CPU

None

mindspore.ops.col2im

Combines an array of sliding local blocks into a large containing tensor.

Ascend GPU CPU

None

mindspore.ops.check_valid

Checks whether the bounding box is in the image.

Ascend GPU CPU

The bounding box specified by bboxes and the image information specified by img_metas need to be valid, i.e.: x0<=x1 , y0<=y1 , and (height,width,ratio) are all positive.

mindspore.ops.crop_and_resize

Extracts crops from the input image Tensor and resizes them.

Ascend GPU CPU

None

mindspore.ops.grid_sample

Given an input and a flow-field grid, computes the output using input values and pixel locations from grid.

Ascend GPU CPU

None

mindspore.ops.interpolate

Samples the input Tensor to the given size or scale_factor by using one of the interpolate algorithms.

Ascend GPU CPU

None

mindspore.ops.iou

Calculates intersection over union for boxes.

Ascend GPU CPU

In Ascend, only computation of float16 data is supported. To avoid overflow, the input length and width are scaled by 0.2 internally.

mindspore.ops.pad

Pads the input tensor according to the padding.

Ascend GPU CPU

None

mindspore.ops.padding

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

Ascend GPU CPU

None

mindspore.ops.pixel_shuffle

Applies the PixelShuffle operation over input input which implements sub-pixel convolutions with stride 1/r .

Ascend GPU CPU

None

mindspore.ops.pixel_unshuffle

Applies the PixelUnshuffle operation over input input which is the inverse of PixelShuffle.

Ascend GPU CPU

None

mindspore.ops.rotary_position_embedding

Implements the Rotary Position Embedding algorithm.

Ascend

This is an experimental API that is subject to change or deletion.

mindspore.ops.rotated_iou

Calculate the overlap area between rotated rectangles.

Ascend

This is an experimental API that is subject to change or deletion.

mindspore.ops.upsample

Alias for mindspore.ops.interpolate() .

Ascend GPU CPU

None

Mathematical Functions

Element-wise Operations

API Name

Description

Supported Platforms

Warning

mindspore.ops.abs

Compute the absolute value of a tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.absolute

Alias for mindspore.ops.abs() .

Ascend GPU CPU

None

mindspore.ops.accumulate_n

Return the element-wise sum of all input tensors.

Ascend GPU

None

mindspore.ops.acos

Compute arccosine of each element in input tensors.

Ascend GPU CPU

None

mindspore.ops.arccos

Alias for mindspore.ops.acos() .

Ascend GPU CPU

None

mindspore.ops.acosh

Computes inverse hyperbolic cosine of each element in inputs tensors.

Ascend GPU CPU

None

mindspore.ops.add

Compute the element-wise sum of the two input tensors.

Ascend GPU CPU

None

mindspore.ops.addcdiv

Divide tensor1 by tensor2 element-wise, multiply the result by the scalar value , and add it to input .

Ascend GPU CPU

None

mindspore.ops.addcmul

Multiply tensor1 by tensor2 element-wise, scale the result by the scalar value , and add it to input .

Ascend GPU CPU

None

mindspore.ops.addmv

Multiply the matrix mat and vector vec , and then add the result to the input .

Ascend GPU CPU

None

mindspore.ops.addn

Return the element-wise sum of all input tensors.

Ascend GPU CPU

None

mindspore.ops.angle

Returns the element-wise angle of the given complex tensor.

Ascend`` GPU CPU

None

mindspore.ops.arccosh

Alias for mindspore.ops.acosh().

Ascend GPU CPU

None

mindspore.ops.arcsin

Alias for mindspore.ops.asin().

Ascend GPU CPU

None

mindspore.ops.arcsinh

Alias for mindspore.ops.asinh().

Ascend GPU CPU

None

mindspore.ops.arctan

Alias for mindspore.ops.atan().

Ascend GPU CPU

None

mindspore.ops.arctanh

Alias for mindspore.ops.atanh().

Ascend GPU CPU

None

mindspore.ops.arctan2

Alias for mindspore.ops.atan2().

Ascend GPU CPU

None

mindspore.ops.asin

Computes arcsine of input tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.asinh

Computes inverse hyperbolic sine of the input element-wise.

Ascend GPU CPU

None

mindspore.ops.atan

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

Ascend GPU CPU

None

mindspore.ops.atan2

Returns arctangent of input/other element-wise.

Ascend GPU CPU

None

mindspore.ops.atanh

Computes inverse hyperbolic tangent of the input element-wise.

Ascend GPU CPU

None

mindspore.ops.atleast_1d

Returns a one-dimensional tensor of each zero-dimensional tensor, while tensors with one or more dimensions remain unchanged.

Ascend GPU CPU

None

mindspore.ops.atleast_2d

Returns a 2-dimensional tensor of each tensor, while tensors with two or more dimensions remain unchanged.

Ascend GPU CPU

None

mindspore.ops.atleast_3d

Returns a 3-dimensional tensor of each tensor, while tensors with three or more dimensions remain unchanged.

Ascend GPU CPU

None

mindspore.ops.bessel_i0

Computes the zeroth order modified Bessel function of the first kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bessel_i0e

Computes the exponentially scaled zeroth order modified Bessel function of the first kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bessel_i1

Computes the first order modified Bessel function of the first kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bessel_i1e

Computes the exponentially scaled first order modified Bessel function of the first kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bessel_j0

Computes the zeroth order Bessel function of the first kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bessel_j1

Computes the first order Bessel function of the first kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bessel_k0

Computes the zeroth order modified Bessel function of the second kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bessel_k0e

Computes the exponentially scaled zeroth order modified Bessel function of the second kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bessel_k1

Computes the first order modified Bessel function of the second kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bessel_k1e

Computes the exponentially scaled first order modified Bessel function of the second kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bessel_y0

Computes the zeroth order Bessel function of the second kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bessel_y1

Computes the first order Bessel function of the second kind for each element input.

Ascend GPU CPU

None

mindspore.ops.bitwise_and

Compute the bitwise AND of two input tensors.

Ascend GPU CPU

None

mindspore.ops.bitwise_left_shift

Perform a left bitwise shift operation on the input element-wise, where the number of bits to shift is specified by other.

Ascend GPU CPU

None

mindspore.ops.bitwise_or

Compute the bitwise OR of two input tensors.

Ascend GPU CPU

None

mindspore.ops.bitwise_right_shift

Perform a right bitwise shift operation on the input element-wise, where the number of bits to shift is specified by other.

Ascend GPU CPU

None

mindspore.ops.bitwise_xor

Compute the bitwise XOR of two input tensors.

Ascend GPU CPU

None

mindspore.ops.ceil

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

Ascend GPU CPU

None

mindspore.ops.clamp

Clamp all elements of the input tensor within the range [min, max].

Ascend GPU CPU

None

mindspore.ops.clip

Alias for mindspore.ops.clamp() .

Ascend GPU CPU

None

mindspore.ops.combinations

Return all r-length subsequences of input tensor.

Ascend GPU CPU

None

mindspore.ops.copysign

Create a float tensor composed of the absolute values of x and the signs of other .

Ascend GPU CPU

None

mindspore.ops.cos

Computes cosine of input element-wise.

Ascend GPU CPU

Using float64 may cause a problem of missing precision.

mindspore.ops.cosh

Computes hyperbolic cosine of input element-wise.

Ascend GPU CPU

None

mindspore.ops.cosine_similarity

Calculate cosine similarity between two input tensors along the specified dimension.

Ascend GPU CPU

None

mindspore.ops.cov

Return the covariance matrix of the input tensor, where the rows of the input tensor represent variables and the columns represent observations.

Ascend GPU CPU

The values of fweights and aweights cannot be negative, and the negative weight scene result is undefined.

mindspore.ops.diag_embed

Create a tensor whose diagonals of certain 2D planes (specified by dim1 and dim2) are filled by input, and all other positions are set to 0.

Ascend GPU CPU

None

mindspore.ops.diff

Computes the n-th forward difference along the given axis.

Ascend GPU CPU

None

mindspore.ops.deg2rad

Convert angles from degrees to radians element-wise.

Ascend GPU CPU

None

mindspore.ops.digamma

Computes the logarithmic derivative of the gamma function on input tensor.

GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.div

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

Ascend GPU CPU

None

mindspore.ops.divide

Alias for mindspore.ops.div() .

Ascend GPU CPU

None

mindspore.ops.erf

Compute the Gauss error of input tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.erfc

Compute the complementary error function of input tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.erfinv

Compute the inverse error of input tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.exp

Compute exponential of the input tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.exp2

Compute base two exponential of the input tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.expm1

Compute exponential of the input tensor, then minus 1, element-wise.

Ascend`` GPU CPU

None

mindspore.ops.floor

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

Ascend GPU CPU

None

mindspore.ops.floor_div

Alias for mindspore.ops.floor_divide() .

Ascend GPU CPU

None

mindspore.ops.floor_divide

Compute element-wise division of input by other and floor the result.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.floor_mod

Compute the remainder of element-wise flooring division of first input by second input.

Ascend GPU CPU

Data of input y should not be 0, or the maximum value of its dtype will be returned. When the elements of input exceed 2048, the accuracy of operator cannot guarantee the requirement of double thousandths in the mini form. Due to different architectures, the calculation results of this operator on NPU and CPU may be inconsistent. If shape is expressed as (D1,D2...,Dn), then D1*D2... *DN<=1000000,n<=8.

mindspore.ops.float_power

Computes the first input to the power of the second input.

GPU CPU

None

mindspore.ops.fmod

Compute the remainder of element-wise division of first input by the second input.

Ascend GPU CPU

None

mindspore.ops.frac

Return the fractional part of each element in the input tensor.

Ascend GPU CPU

None

mindspore.ops.gcd

Computes greatest common divisor of input tensors element-wise.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.hypot

Given the legs of a right triangle, return its hypotenuse, element-wise.

Ascend GPU CPU

None

mindspore.ops.igamma

Calculates lower regularized incomplete Gamma function.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.igammac

Calculates upper regularized incomplete Gamma function.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.imag

Return a new tensor containing imaginary value of the input tensor, element-wise.

Ascend GPU CPU

None

mindspore.ops.i0

For details, please refer to mindspore.ops.bessel_i0().

GPU CPU

None

mindspore.ops.inv

Computes Reciprocal of input tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.invert

Flip all bits of input tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.lcm

Computes least common multiplier of input tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.ldexp

Multiplies input tensor by 2other element-wise.

Ascend GPU CPU

None

mindspore.ops.lerp

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

Ascend GPU CPU

None

mindspore.ops.log

Compute the natural logarithm of the input tensor element-wise.

Ascend GPU CPU

If the input value of operator Log is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affacted.

mindspore.ops.log2

Compute the logarithm to the base 2 of the input tensor element-wise.

Ascend GPU CPU

If the input value of operator log2 is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affected.

mindspore.ops.log10

Compute the logarithm to the base 10 of the input tensor element-wise.

Ascend GPU CPU

If the input value of operator log10 is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affected.

mindspore.ops.log1p

Compute the natural logarithm of (tensor + 1) element-wise.

Ascend GPU CPU

None

mindspore.ops.logaddexp

Computes the logarithm of the sum of exponentiations of the inputs.

Ascend GPU CPU

None

mindspore.ops.logaddexp2

Computes the logarithm of the sum of exponentiations in base of 2 of the inputs.

Ascend GPU CPU

None

mindspore.ops.logical_and

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

Ascend GPU CPU

None

mindspore.ops.logical_not

Compute the "logical NOT" of the input tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.logical_or

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

Ascend GPU CPU

None

mindspore.ops.logical_xor

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

Ascend CPU

None

mindspore.ops.logit

Calculate the logit of a tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.mul

Multiplies two tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.multiply

Alias for mindspore.ops.asinh().

Ascend GPU CPU

None

mindspore.ops.mvlgamma

Compute the multivariate log-gamma function with dimension p element-wise.

Ascend GPU CPU

None

mindspore.ops.neg

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

Ascend GPU CPU

None

mindspore.ops.negative

Alias for mindspore.ops.neg() .

Ascend GPU CPU

None

mindspore.ops.nextafter

Returns the next representable floating-point value after input towards other element-wise.

Ascend GPU CPU

None

mindspore.ops.polar

Converts polar coordinates to Cartesian coordinates.

Ascend GPU CPU

None

mindspore.ops.polygamma

Computes the n-th derivative of the polygamma function on input.

GPU CPU

None

mindspore.ops.positive

Return self tensor.

Ascend GPU CPU

None

mindspore.ops.pow

Calculate the exponent power of each element in input.

Ascend GPU CPU

None

mindspore.ops.rad2deg

Converts angles in radians to angles in degrees element-wise.

Ascend GPU CPU

None

mindspore.ops.ravel

Expand the multidimensional Tensor into 1D along the 0 axis direction.

Ascend GPU CPU

None

mindspore.ops.real

Return a tensor that is the real part of the input.

Ascend GPU CPU

None

mindspore.ops.reciprocal

Returns reciprocal of a tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.remainder

Compute the remainder of division for the input tensor element-wise.

Ascend GPU CPU

When the elements of input exceed 2048, there might be accuracy problems. The calculation results of this operator on Ascend and CPU might be inconsistent. If shape is expressed as (D1,D2... ,Dn), then D1*D2... *DN<=1000000,n<=8.

mindspore.ops.rot90

Rotate a n-D tensor by 90 degrees in the plane specified by dims axis.

Ascend GPU CPU

None

mindspore.ops.round

Round elements of input to the nearest integer.

Ascend GPU CPU

None

mindspore.ops.rsqrt

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

Ascend GPU CPU

None

mindspore.ops.sgn

Extension of mindspore.ops.sign() in complex domain.

Ascend GPU CPU

None

mindspore.ops.sign

Return an element-wise indication of the sign of a number.

Ascend GPU CPU

None

mindspore.ops.signbit

Determine the symbol of each element.

Ascend GPU CPU

None

mindspore.ops.sin

Compute sine of the input tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.sinc

Compute the normalized sinc of input.

Ascend GPU CPU

None

mindspore.ops.sinh

Compute hyperbolic sine of the input element-wise.

Ascend GPU CPU

None

mindspore.ops.sqrt

Return sqrt of a tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.square

Return square of a tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.sub

Subtract the second input from the first input element-wise.

Ascend GPU CPU

None

mindspore.ops.subtract

Subtract other scaled by alpha from input.

Ascend GPU CPU

None

mindspore.ops.t

Transpose a 2-D tensor.

Ascend GPU CPU

None

mindspore.ops.tan

Computes tangent of input element-wise.

Ascend GPU CPU

None

mindspore.ops.tanhshrink

Apply the element-wise Tanhshrink function.

Ascend GPU CPU

None

mindspore.ops.trapz

Compute the trapezoidal rule along dim.

Ascend GPU CPU

None

mindspore.ops.tril_indices

Return a 2-by-N tensor containing the indices of the lower triangular elements of a row * col matrix.

Ascend GPU CPU

None

mindspore.ops.triu_indices

Return a 2-by-N tensor containing the indices of the upper triangular elements of a row * col matrix.

Ascend GPU CPU

None

mindspore.ops.true_divide

Alias for mindspore.ops.div() with rounding_mode=None .

Ascend GPU CPU

None

mindspore.ops.trunc

Returns a tensor with the truncated integer values of the elements of the input tensor.

Ascend GPU CPU

None

mindspore.ops.truncate_div

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

Ascend GPU CPU

None

mindspore.ops.truncate_mod

Return the remainder of division element-wise.

Ascend GPU CPU

The input data does not support 0. When the elements of input exceed 2048 , the accuracy of operator cannot guarantee the requirement of double thousandths in the mini form. Due to different architectures, the calculation results of this operator on NPU and CPU may be inconsistent. If shape is expressed as (D1,D2... ,Dn), then D1*D2... *DN<=1000000,n<=8.

mindspore.ops.xdivy

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

Ascend GPU CPU

None

mindspore.ops.xlogy

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

Ascend GPU CPU

On Ascend, the data type of input and other must be float16 or float32.

mindspore.ops.zeta

Elemental-wise compute the Hurwitz zeta output.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

Reduction Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.all

Tests if all element in input evaluates to True along the given axes.

Ascend GPU CPU

None

mindspore.ops.amax

Return the maximum values along the given axis of the tensor.

Ascend GPU CPU

None

mindspore.ops.amin

Return the minimum values along the given axis of the tensor.

Ascend GPU CPU

None

mindspore.ops.aminmax

Return the minimum values and maximum values along the given axes of the tensor.

Ascend GPU CPU

None

mindspore.ops.any

Tests if any element in input evaluates to True along the given axes.

Ascend GPU CPU

None

mindspore.ops.argmax

Return the indices of the maximum values along a specified dimension of the tensor.

Ascend GPU CPU

None

mindspore.ops.argmin

Return the indices of the minimum values along a specified dimension of the tensor.

Ascend GPU CPU

None

mindspore.ops.cummax

Return the cumulative maximum values and their indices along the given axis of the tensor.

Ascend GPU CPU

None

mindspore.ops.cummin

Return the cumulative minimum values and their indices along the given axis of the tensor.

Ascend GPU CPU

None

mindspore.ops.cumprod

Return the cumulative product along the given dimension of the tensor.

Ascend GPU CPU

None

mindspore.ops.cumsum

Return the cumulative sum along the given axis of the tensor.

Ascend GPU CPU

None

mindspore.ops.fmax

Computes the maximum of input tensors element-wise.

CPU

None

mindspore.ops.histc

Computes the histogram of a tensor.

Ascend CPU

None

mindspore.ops.logcumsumexp

Calculate the log of cumulative summed exponentials of the tensor along a specified dimension.

Ascend CPU GPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.logsumexp

Calculate the log of summed exponentials of the tensor along a specified dimension.

Ascend GPU CPU

None

mindspore.ops.max

Return the maximum values and their indices along the given axis of the tensor.

Ascend GPU CPU

None

mindspore.ops.mean

Compute the mean(s) of the tensor along the specified axis(axes).

Ascend GPU CPU

None

mindspore.ops.median

Return the median(s) and indice(s) of the tensor along the specified axis.

GPU CPU

indices does not necessarily contain the first occurrence of each median value found in the input, unless it is unique. The specific implementation of this API is device-specific. The results may be different on CPU and GPU.

mindspore.ops.min

Return the minimum values and their indices along the given axis of the tensor.

Ascend GPU CPU

None

mindspore.ops.norm

Compute the matrix norm or vector norm of the tensor along a specified dimension.

Ascend GPU CPU

None

mindspore.ops.prod

Return the product(s) of the tensor along the specified axis(axes).

Ascend GPU CPU

None

mindspore.ops.std

Compute the standard deviation of the tensor along a specified axis.

Ascend GPU CPU

None

mindspore.ops.std_mean

Compute the standard deviation and the mean of the tensor along a specified axis.

Ascend GPU CPU

None

mindspore.ops.var

Compute the variance of the tensor along a specified axis.

Ascend GPU CPU

None

mindspore.ops.var_mean

Compute the variance and the mean of the tensor along a specified axis.

Ascend GPU CPU

None

Comparison Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.argsort

Return the indices that sort the tensor along the specified axis.

Ascend GPU CPU

None

mindspore.ops.approximate_equal

Return a boolean tensor where two tensors are element-wise equal within a tolerance.

Ascend GPU CPU

None

mindspore.ops.bucketize

Return the indices of the buckets to which each element in the input tensor belongs.

Ascend GPU CPU

None

mindspore.ops.eq

Compute the equivalence of the two inputs element-wise.

Ascend GPU CPU

None

mindspore.ops.equal

Compute the equivalence of the two inputs element-wise.

Ascend GPU CPU

None

mindspore.ops.ge

Compute the value of input>=other element-wise.

Ascend GPU CPU

None

mindspore.ops.greater

Compute the value of input>other element-wise.

Ascend GPU CPU

None

mindspore.ops.greater_equal

Compute the value of input>=other element-wise.

Ascend GPU CPU

None

mindspore.ops.gt

Compute the value of input>other element-wise.

Ascend GPU CPU

None

mindspore.ops.intopk

Return whether the elements in second input tensor exist among the top k elements of the first input tensor.

Ascend GPU CPU

None

mindspore.ops.isclose

Return a boolean tensor where two tensors are element-wise equal within a tolerance.

Ascend GPU CPU

None

mindspore.ops.isfinite

Return a boolean tensor indicating which elements are finite.

Ascend GPU CPU

None

mindspore.ops.isinf

Return a boolean tensor indicating which elements are +/- inifnity.

Ascend CPU GPU

This is an experimental API that is subject to change. For Ascend, it is only supported on platforms above Atlas A2.

mindspore.ops.isnan

Return a boolean tensor indicating which elements are NaN.

Ascend GPU CPU

None

mindspore.ops.isneginf

Return a boolean tensor indicating which elements are negative infinity.

Ascend GPU CPU

For Ascend, it is only supported on platforms above Atlas A2.

mindspore.ops.isposinf

Return a boolean tensor indicating which elements are positive infinity.

Ascend GPU CPU

For Ascend, it is only supported on platforms above Atlas A2.

mindspore.ops.isreal

Return a boolean tensor indicating which elements are real.

GPU CPU

None

mindspore.ops.is_complex

Return a boolean tensor indicating which elements are complex.

Ascend GPU CPU

None

mindspore.ops.is_floating_point

If the data type of the tensor is a floating point data type, return True.

Ascend GPU CPU

None

mindspore.ops.le

Compute the value of input<=other element-wise.

Ascend GPU CPU

None

mindspore.ops.less

Compute the value of input<other element-wise.

Ascend GPU CPU

None

mindspore.ops.less_equal

Compute the value of input<=other element-wise.

Ascend GPU CPU

None

mindspore.ops.lt

Alias for mindspore.ops.less() .

Ascend GPU CPU

None

mindspore.ops.maximum

Compute the maximum of the two input tensors element-wise.

Ascend GPU CPU

If all inputs are scalar of integers. In Graph mode, the output will be Tensor of int32, while in PyNative mode, the output will be Tensor of int64.

mindspore.ops.minimum

Compute the minimum of the two input tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.msort

Return a tensor obtained by sorting the input tensor in ascending order along its first dimension.

Ascend GPU CPU

None

mindspore.ops.ne

Compute the non-equivalence of two inputs element-wise.

Ascend GPU CPU

None

mindspore.ops.not_equal

Alias for mindspore.ops.ne() .

Ascend GPU CPU

None

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

None

mindspore.ops.topk

Return the top k largest or smallest elements of the input tensor along a specified dimension.

Ascend GPU CPU

If sorted is set to False, it will use the aicpu operator, the performance may be reduced. In addition, due to different memory layout and traversal methods on different platforms, the display order of calculation results may be inconsistent when sorted is False.

Linear Algebraic Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.addbmm

Applies batch matrix multiplication to batch1 and batch2, with a reduced add step and add input to the result.

Ascend GPU CPU

None

mindspore.ops.addmm

Multiplies matrix mat1 and matrix mat2.

Ascend GPU CPU

None

mindspore.ops.addr

Computes the outer product of two vector vec1 and vec2, and adds the resulting matrix to x.

Ascend GPU CPU

None

mindspore.ops.adjoint

Calculates the conjugation of Tensor element by element, and transposes the last two dimensions.

Ascend GPU CPU

None

mindspore.ops.baddbmm

The result is the sum of the input and a batch matrix-matrix product of matrices in batch1 and batch2.

Ascend GPU CPU

None

mindspore.ops.batch_dot

Computation of batch dot product between samples in two tensors containing batch dims, i.e. x1 or x2 's first dimension is batch size.

Ascend GPU CPU

None

mindspore.ops.bmm

Computes matrix multiplication between two tensors by batch.

Ascend GPU CPU

None

mindspore.ops.cholesky

Return the Cholesky decomposition of zero or more batch dimensions consisting of symmetric positive-definite matrices.

GPU CPU

None

mindspore.ops.cholesky_solve

Computes the solution of a set of linear equations with a positive definite matrix, according to its Cholesky decomposition factor input2 .

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.cond

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

GPU CPU

None

mindspore.ops.dot

Computation a dot product between samples in two tensors.

Ascend GPU CPU

None

mindspore.ops.eigvals

Compute the eigenvalues of a square matrix.

Ascend CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.geqrf

Perform a QR decomposition on the input tensor A=QR.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.ger

Calculate the outer product of two arrays input and vec2.

Ascend GPU CPU

None

mindspore.ops.inner

Return the dot product of two 1-D tensors.

Ascend GPU CPU

None

mindspore.ops.inverse

Compute the inverse of the input matrix.

GPU CPU

None

mindspore.ops.kron

Compute the Kronecker product of two tensors.

Ascend GPU CPU

None

mindspore.ops.logdet

Calculate log determinant of one or a batch of square matrices.

CPU

None

mindspore.ops.lu_solve

Compute the solution to a system of linear equations Ay=b.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.lu_unpack

Unpack the LU decomposition returned by mindspore.scipy.linalg.lu_factor() into the P, L, U matrices.

GPU CPU

None

mindspore.ops.matmul

Return the matrix product of two tensors.

Ascend GPU CPU

None

mindspore.ops.matrix_band_part

Copy a tensor setting everything outside a central band in each innermost matrix to zero.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.matrix_solve

Solves systems of linear equations.

Ascend CPU

On GPU, if the matrix is irreversible, an error may be reported or an unknown result may be returned.

mindspore.ops.matrix_band_part

Copy a tensor setting everything outside a central band in each innermost matrix to zero.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.matrix_diag

Return a tensor with the contents in x as k[0]-th to k[1]-th diagonals of a matrix, with everything else padded with padding_value .

Ascend GPU CPU

None

mindspore.ops.matrix_diag_part

Return a tensor that retains the values of the specified diagonal while setting all other elements to zero.

Ascend GPU CPU

None

mindspore.ops.matrix_set_diag

Return a tensor by replacing the elements on the k[0]-th to k[1]-th diagonals of the matrix x with the values from the input diagonal .

Ascend GPU CPU

None

mindspore.ops.mm

Returns the matrix product of two arrays.

Ascend GPU CPU

None

mindspore.ops.mv

Multiplies matrix mat and vector vec.

Ascend GPU CPU

None

mindspore.ops.outer

Compute outer product of two tensors.

Ascend GPU CPU

None

mindspore.ops.ormqr

Calculates the product of a matrix other and a matrix Q (represented by Householder vectors input and Householder reflection coefficients tau).

GPU

None

mindspore.ops.orgqr

Compute the first N columns of a product of Householder matrices.

Ascend GPU CPU

None

mindspore.ops.ormqr

Calculates the product of a matrix other and a matrix Q (represented by Householder vectors input and Householder reflection coefficients tau).

GPU

None

mindspore.ops.pinv

Computes the (Moore-Penrose) pseudo-inverse of a matrix.

CPU

None

mindspore.ops.svd

Computes the singular value decompositions of one or more matrices.

Ascend GPU CPU

None

mindspore.ops.slogdet

Computes the sign and the log of the absolute value of the determinant of one or more square matrices.

Ascend GPU CPU

None

mindspore.ops.trace

Return the sum of the elements along the diagonal of the input tensor.

Ascend GPU CPU

None

mindspore.ops.tensor_dot

Compute the tensor dot product along the specified axes.

Ascend GPU CPU

None

mindspore.ops.vander

Generates a Vandermonde matrix.

Ascend GPU CPU

None

mindspore.ops.vecdot

Calculates the dot product of two batches of vectors along the specified dimension.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

Spectral Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.bartlett_window

Bartlett window function.

Ascend GPU CPU

None

mindspore.ops.blackman_window

Blackman window function.

Ascend GPU CPU

None

mindspore.ops.hamming_window

Hamming window function.

Ascend GPU CPU

None

mindspore.ops.hann_window

Hann window function.

Ascend GPU CPU

None

mindspore.ops.kaiser_window

Kaiser window function.

Ascend GPU CPU

None

Tensor Operation Functions

Tensor Creation

API Name

Description

Supported Platforms

Warning

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

None

mindspore.ops.eye

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

Ascend GPU CPU

None

mindspore.ops.fill

Create a tensor filled with a specified value.

Ascend GPU CPU

None

mindspore.ops.full

Create a tensor filled with a specified value.

Ascend GPU CPU

None

mindspore.ops.full_like

Return a tensor of the same shape as input and filled with a specified value.

Ascend GPU CPU

None

mindspore.ops.linspace

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

Ascend GPU CPU

None

mindspore.ops.logspace

Return a tensor with steps elements, evenly distributed in the interval [ basestart , baseend].

Ascend GPU CPU

None

mindspore.ops.move_to

mindspore.ops.one_hot

Generate a new tensor, where the positions specified by indices are assigned on_value, and all other positions are assigned off_value.

Ascend GPU CPU

None

mindspore.ops.ones

Creates a tensor filled with value ones.

Ascend GPU CPU

For argument shape, Tensor type input will be deprecated in the future version.

mindspore.ops.ones_like

Return a tensor filled with 1, with the same size as input.

Ascend GPU CPU

None

mindspore.ops.arange

Returns a tensor with a step length of step in the interval [ start , end ).

Ascend GPU CPU

None

mindspore.ops.range

Returns a tensor with a step length of step in the interval [ start , end ).

GPU CPU

None

mindspore.ops.zeros

Creates a tensor filled with value zeros.

Ascend GPU CPU

For argument size, Tensor type input will be deprecated in the future version.

mindspore.ops.zeros_like

Return a tensor filled with 0, with the same size as input .

Ascend GPU CPU

None

mindspore.ops.heaviside

Perform Heaviside step function element-wise.

Ascend GPU CPU

None

Randomly Generating Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.bernoulli

Generates Bernoulli random values (0 or 1).

GPU CPU

None

mindspore.ops.gamma

Generates random numbers according to the Gamma random number distribution.

Ascend

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.laplace

Generates random numbers according to the Laplace random number distribution.

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.multinomial

Generate a tensor from a multinomial distribution.

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.multinomial_with_replacement

Generate a tensor from a multinomial distribution.

CPU

None

mindspore.ops.rand

Return a new tensor that fills numbers from the uniform distribution over an interval [0,1) based on the given size and dtype.

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.rand_like

Return a tensor with the same shape as input that is filled with random numbers from a uniform distribution on the interval [0,1).

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.randint

Return a tensor whose elements are random integers in the range of [ low , high ) .

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.randint_like

Returns a tensor with the same shape as input whose elements are random integers in the range of [ low , high ) .

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.randn

Return a new tensor with given shape and dtype, filled with random numbers from the standard normal distribution.

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.randn_like

Return a tensor with the same shape as input, filled with random numbers from the standard normal distribution.

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.random_gamma

Generate random numbers from the Gamma distribution(s).

CPU

None

mindspore.ops.random_poisson

Generate random number Tensor with shape according to a Poisson distribution with mean rate.

GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.randperm

Generates random permutation of integers from 0 to n-1.

CPU

This is an experimental API that is subject to change or deletion. The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.standard_laplace

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

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.standard_normal

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

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.uniform

Generates random numbers according to the Uniform random number distribution.

GPU CPU

None

Array Operation

API Name

Description

Supported Platforms

Warning

mindspore.ops.argwhere

Return a tensor of containing the positions of all non-zero elements in the input tensor.

Ascend GPU CPU

None

mindspore.ops.batch_to_space_nd

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

Ascend GPU CPU

None

mindspore.ops.bincount

Count the frequency of each value in the input tensor of non-negative ints.

Ascend GPU CPU

None

mindspore.ops.block_diag

Creates a block diagonal matrix from the provided tensor.

Ascend GPU CPU

None

mindspore.ops.broadcast_to

Broadcasts input tensor to a given shape.

Ascend GPU CPU

None

mindspore.ops.cat

Connect input tensors along with the given axis.

Ascend GPU CPU

None

mindspore.ops.channel_shuffle

Divide the channels in a tensor of shape (,C,H,W) into g groups and rearrange them as (,Cg,g,HW), while retaining the original tensor shape in the final output.

Ascend CPU

None

mindspore.ops.chunk

Cut the input Tensor into chunks sub-tensors along the specified axis.

Ascend GPU CPU

None

mindspore.ops.column_stack

Stacks 1-D tensors as columns into a 2-D tensor.

Ascend GPU CPU

None

mindspore.ops.concat

Alias for mindspore.ops.cat().

None

mindspore.ops.conj

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

Ascend GPU CPU

None

mindspore.ops.count_nonzero

Count number of nonzero elements across axis of input tensor.

Ascend GPU CPU

None

mindspore.ops.deepcopy

Returns a deepcopy of input tensor.

Ascend GPU CPU

None

mindspore.ops.diag

Return a tensor with the input as its diagonal elements and 0 elsewhere.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.diagflat

If input is a vector (1-D tensor), then returns a 2-D square tensor with the elements of input as the diagonal, If input is a tensor with more than one dimension, then returns a 2-D tensor with diagonal elements equal to a flattened input.

Ascend GPU CPU

None

mindspore.ops.diagonal

Returns diagonals of the input tensor along specified dimension.

Ascend GPU CPU

None

mindspore.ops.diagonal_scatter

Embeds the values of the src tensor into input along the diagonal elements of input, with respect to dim1 and dim2 .

Ascend GPU CPU

None

mindspore.ops.dyn_shape

Returns the shape of the input tensor.

Ascend GPU CPU

None

mindspore.ops.dsplit

Splits a tensor along the 3rd axis.

Ascend GPU CPU

None

mindspore.ops.dstack

Stacks tensors along the third axis.

Ascend GPU CPU

None

mindspore.ops.einsum

According to the Einstein summation Convention (Einsum), the product of the input tensor elements is summed along the specified dimension.

GPU

None

mindspore.ops.expand_dims

Adds an additional axis to input tensor.

Ascend GPU CPU

None

mindspore.ops.flip

Reverses elements in a tensor along the given dims.

Ascend GPU CPU

None

mindspore.ops.fliplr

Flip the input tensor in left/right direction.

Ascend GPU CPU

None

mindspore.ops.flipud

Flip the input tensor in up/down direction.

Ascend GPU CPU

None

mindspore.ops.gather

Returns the slice of the input tensor corresponding to the elements of input_indices on the specified axis.

Ascend GPU CPU

None

mindspore.ops.gather_d

Gathers elements along an axis specified by dim.

Ascend GPU CPU

None

mindspore.ops.gather_elements

Gathers elements along the specified dim and indices.

Ascend GPU CPU

On Ascend, the behavior is unpredictable in the following cases: the value of index is not in the range [-input.shape[dim], input.shape[dim]) in forward; the value of index is not in the range [0, input.shape[dim]) in backward.

mindspore.ops.gather_nd

Gathers slices from the input tensor by specified indices.

Ascend GPU CPU

None

mindspore.ops.hstack

Stacks tensors in sequence horizontally.

Ascend GPU CPU

None

mindspore.ops.hsplit

Splits a tensor into multiple sub-tensors horizontally.

Ascend GPU CPU

None

mindspore.ops.index_add

Add the elements of input y into input x along the given axis and indices.

Ascend GPU CPU

None

mindspore.ops.index_fill

Fills the elements of the input x with value along the given axis and indices.

Ascend GPU CPU

None

mindspore.ops.index_select

Select the input tensor according to the specified axis and index and return a new tensor.

Ascend GPU CPU

None

mindspore.ops.inplace_add

Add x to v according to the indices.

Ascend GPU CPU

None

mindspore.ops.inplace_index_add

Add updates to var according to the indices and axis.

Ascend CPU

None

mindspore.ops.inplace_sub

Subtract v in x according to the indices.

Ascend GPU CPU

None

mindspore.ops.inplace_update

Updates x to v according to the indices.

GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.is_nonzero

Determine whether the input Tensor contains 0 or False.

Ascend GPU CPU

None

mindspore.ops.masked_fill

Fills elements of tensor with value where mask is True.

Ascend GPU CPU

None

mindspore.ops.masked_select

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

Ascend GPU CPU

None

mindspore.ops.meshgrid

Creates grids of coordinates specified by the 1D inputs。

Ascend GPU CPU

None

mindspore.ops.narrow

Slice the tensor from the start position with a length of length along axis .

Ascend GPU CPU

None

mindspore.ops.moveaxis

Move axis of an array from source to destination.

Ascend GPU CPU

None

mindspore.ops.movedim

Swap two dimensions of the input tensor.

Ascend GPU CPU

None

mindspore.ops.nan_to_num

Replace the NaN, positive infinity and negative infinity values in input with the specified values in nan, posinf and neginf respectively.

Ascend CPU

For Ascend, it is only supported on Atlas A2 Training Series Products. This is an experimental API that is subject to change or deletion.

mindspore.ops.nanmean

Computes the mean of input in specified dimension, ignoring NaN.

Ascend GPU CPU

None

mindspore.ops.nanmedian

Computes the median and indices of input in specified dimension, ignoring NaN.

CPU

indices does not necessarily contain the first occurrence of each median value found in the input, unless it is unique.

mindspore.ops.nansum

Computes sum of input over a given dimension, ignoring NaN.

Ascend GPU CPU

None

mindspore.ops.normal

Return a random tensor that conforms to the normal (Gaussian) distribution.

Ascend GPU CPU

The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.

mindspore.ops.nonzero

Return the positions of all non-zero values.

Ascend GPU CPU

None

mindspore.ops.numel

Return the total number of elements in the tensor.

Ascend GPU CPU

None

mindspore.ops.permute

Permute the input tensor along the specified axis.

Ascend GPU CPU

None

mindspore.ops.population_count

Calculate the number of 1 bits in the binary representation of each element in the input tensor.

Ascend GPU CPU

None

mindspore.ops.rank

Return the rank of a tensor.

Ascend GPU CPU

None

mindspore.ops.repeat_elements

Repeat elements of a tensor along an axis, like mindspore.numpy.repeat() .

Ascend GPU CPU

None

mindspore.ops.repeat_interleave

Repeat elements of a tensor along an axis, like mindspore.numpy.repeat().

Ascend GPU CPU

None

mindspore.ops.reshape

Reshape the input tensor based on the given shape.

Ascend GPU CPU

None

mindspore.ops.reverse

This interface will be deprecated in the future, and use mindspore.ops.flip() instead.

Ascend GPU CPU

None

mindspore.ops.reverse_sequence

Partially reverse the input sequence.

Ascend GPU CPU

None

mindspore.ops.roll

Roll the elements of a tensor along a dimension.

Ascend GPU

None

mindspore.ops.row_stack

Alias for mindspore.ops.vstack() .

Ascend GPU CPU

None

mindspore.ops.scatter

Update the value in src to input according to the specified index.

Ascend GPU CPU

None

mindspore.ops.scatter_nd

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

Ascend GPU CPU

None

mindspore.ops.select

The conditional tensor determines whether the corresponding element in the output must be selected from input (if True) or other (if False) based on the value of each element.

Ascend GPU CPU

None

mindspore.ops.select_scatter

On the specified dimension axis of input , src is scattered into input on the specified index of input .

Ascend GPU CPU

None

mindspore.ops.sequence_mask

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

GPU CPU

None

mindspore.ops.shape

Return the shape of the input tensor.

Ascend GPU CPU

None

mindspore.ops.shuffle

Randomly shuffle a tensor along its first dimension.

Ascend GPU CPU

None

mindspore.ops.size

Count the total number of elements in input_x .

Ascend GPU CPU

None

mindspore.ops.slice

Slice a tensor in the specified shape.

Ascend GPU CPU

None

mindspore.ops.slice_scatter

Embed src into the sliced input along the specified axis .

Ascend GPU CPU

None

mindspore.ops.sort

Sort the elements of the input tensor along the given axis.

Ascend GPU CPU

Currently, the data types of float16, uint8, int8, int16, int32, int64 are well supported. If use float32, it may cause loss of accuracy.

mindspore.ops.space_to_batch_nd

Divides a tensor's spatial dimensions into blocks and combines the block sizes with the original batch.

Ascend GPU CPU

None

mindspore.ops.sparse_segment_mean

Computes the mean of sparse segments in the input tensor.

GPU CPU

None

mindspore.ops.split

Split the tensor into chunks along the given axis.

Ascend GPU CPU

None

mindspore.ops.squeeze

Remove length one axes from input tensor.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.stack

Stack input tensors in specified axis.

Ascend GPU CPU

None

mindspore.ops.strided_slice

Extracts a strided slice of a Tensor based on begin/end index and strides.

Ascend GPU CPU

None

mindspore.ops.sum

Calculate sum of tensor elements over a given dim.

Ascend GPU CPU

None

mindspore.ops.swapaxes

Interchange two axes of a tensor.

Ascend GPU CPU

None

mindspore.ops.swapdims

Interchange two dims of a tensor.

Ascend GPU CPU

None

mindspore.ops.tensor_scatter_add

Return a new tensor by adding the values from updates in input_x indicated by indices .

Ascend GPU CPU

None

mindspore.ops.tensor_scatter_div

Return a new tensor which input_x is divided by the values from updates indicated by indices .

GPU CPU

None

mindspore.ops.tensor_scatter_max

Return a new tensor by performing a maximum update on input_x at the specified indices with the given update values.

GPU CPU

None

mindspore.ops.tensor_scatter_min

Return a new tensor by performing a minimum update on input_x at the specified indices with the given update values.

Ascend GPU CPU

None

mindspore.ops.tensor_scatter_mul

Return a new tensor by performing a multiplication update on input_x at the specified indices with the given update values.

GPU CPU

None

mindspore.ops.tensor_scatter_sub

Return a new tensor by performing a subtraction update on input_x at the specified indices with the given update values.

Ascend GPU CPU

None

mindspore.ops.tensor_scatter_elements

Return a new tensor by performing a specified operation update on input_x at the specified indices with the given update values.

Ascend GPU CPU

The order in which updates are applied is nondeterministic, meaning that if there are multiple index vectors in indices that correspond to the same position, the value of that position in the output will be nondeterministic. On Ascend, the reduction only support set to "none" for now. On Ascend, the data type of input_x must be float16 or float32. This is an experimental API that is subject to change or deletion.

mindspore.ops.tensor_split

Split the input tensor into multiple subtensors according to the specified indices or chunks.

Ascend GPU CPU

None

mindspore.ops.tile

Creates a new tensor by repeating the elements in the input tensor dims times.

None

mindspore.ops.tril

Zero the input tensor above the diagonal specified.

Ascend GPU CPU

None

mindspore.ops.triu

Zero the input tensor below the diagonal specified.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.transpose

Transpose dimensions of the input tensor according to input permutation.

Ascend GPU CPU

None

mindspore.ops.unbind

Removes a tensor dimension in specified axis.

Ascend GPU CPU

None

mindspore.ops.unfold

Extracts sliding local blocks from a batched input tensor.

Ascend GPU CPU

The output is a 3-dimensional Tensor whose shape is (N,C×(kernel_size),L) . This is an experimental API that is subject to change or deletion.

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

This is an experimental API that is subject to change or deletion.

mindspore.ops.unique_consecutive

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

Ascend GPU CPU

None

mindspore.ops.unique_with_pad

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

Deprecated

mindspore.ops.unique_with_pad() is deprecated from version 2.4 and will be removed in a future version. Please use the mindspore.ops.unique() combined with mindspore.ops.pad() to realize the same function.

mindspore.ops.unsorted_segment_max

Compute the maximum of the input tensor along segments.

Ascend GPU CPU

None

mindspore.ops.unsorted_segment_min

Compute the minimum of the input tensor along segments.

Ascend GPU CPU

None

mindspore.ops.unsorted_segment_prod

Compute the product of the input tensor along segments.

Ascend GPU CPU

None

mindspore.ops.unsorted_segment_sum

Compute the sum of the input tensor along segments.

Ascend GPU CPU

None

mindspore.ops.unsqueeze

Adds an additional dimension to the input tensor at the given dimension.

Ascend GPU CPU

None

mindspore.ops.unstack

Unstack the input tensor along the specified axis.

Ascend GPU CPU

None

mindspore.ops.view_as_real

Return a real tensor with the last dimension of size 2, composed of the real and imaginary parts of the complex elements in the input tensor.

GPU CPU

None

mindspore.ops.vsplit

Split the input tensor with two or more dimensions, into multiple sub-tensors vertically according to indices_or_sections.

Ascend GPU CPU

None

mindspore.ops.vstack

Stacks tensors in sequence vertically.

Ascend GPU CPU

None

mindspore.ops.where

Return a tensor in which the elements are selected from input or other based on the condition.

Ascend GPU CPU

None

mindspore.ops.cross

Compute the cross product of two input tensors along the specified dimension.

Ascend CPU

None

mindspore.ops.renorm

Returns a tensor where each subtensor along the specified dimension is renormalized such that its p norm is less than or equal to maxnorm.

Ascend GPU CPU

None

Type Cast

API Name

Description

Supported Platforms

Warning

mindspore.ops.cast

Returns a tensor with the new specified data type.

Ascend GPU CPU

None

mindspore.ops.is_tensor

Check whether the input object is mindspore.Tensor .

Ascend GPU CPU

None

mindspore.ops.scalar_cast

The interface is deprecated from version 2.3 and will be removed in a future version, please use int(x) or float(x) instead.

Deprecated

None

mindspore.ops.scalar_to_tensor

Converts a scalar to a tensor with the specified dtype.

Ascend GPU CPU

None

mindspore.ops.tuple_to_array

Converts a tuple to a tensor.

Ascend GPU CPU

None

Gradient Clipping

API Name

Description

Supported Platforms

Warning

mindspore.ops.clip_by_global_norm

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

Ascend GPU CPU

None

mindspore.ops.clip_by_value

Clips tensor values to a specified min and max.

Ascend GPU CPU

None

mindspore.ops.clip_by_norm

The input Tensor is cropped based on norm.

Ascend GPU CPU

None

Parameter Operation Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.assign

Assigns a parameter or tensor with a value.

Ascend GPU CPU

None

mindspore.ops.assign_add

Updates a parameter or tensor by adding a value to it.

Ascend GPU CPU

None

mindspore.ops.assign_sub

Updates a parameter or tensor by subtracting a value from it.

Ascend GPU CPU

None

mindspore.ops.scatter_add

Perform an addition update on input_x based on the specified indices and update values.

Ascend GPU CPU

None

mindspore.ops.scatter_div

Perform a division update on input_x based on the specified indices and update values.

Ascend GPU CPU

None

mindspore.ops.scatter_min

Perform a minimum update on input_x based on the specified indices and update values.

Ascend GPU CPU

None

mindspore.ops.scatter_max

Perform a maximum update on input_x based on the specified indices and update values.

Ascend GPU CPU

None

mindspore.ops.scatter_mul

Perform a multiplication update on input_x based on the specified indices and update values.

Ascend GPU CPU

None

mindspore.ops.scatter_nd_add

Perform a sparse addition update on input_x based on the specified indices and update values.

Ascend GPU CPU

None

mindspore.ops.scatter_nd_div

Perform a sparse division update on input_x based on the specified indices and update values.

GPU CPU

None

mindspore.ops.scatter_nd_max

Perform a sparse maximum update on input_x based on the specified indices and update values.

Ascend GPU CPU

None

mindspore.ops.scatter_nd_min

Perform a sparse minimum update on input_x based on the specified indices and update values.

Ascend GPU CPU

None

mindspore.ops.scatter_nd_mul

Perform a sparse multiplication update on input_x based on the specified indices and update values.

GPU CPU

None

mindspore.ops.scatter_nd_sub

Perform a sparse subtraction update on input_x based on the specified indices and update values.

Ascend GPU CPU

None

mindspore.ops.scatter_update

Updates the input tensor values using the given input indices and update values.

Ascend GPU CPU

None

Differential Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.derivative

This function is designed to calculate the higher order differentiation of given composite function.

Ascend GPU CPU

None

mindspore.ops.jet

This function is designed to calculate the higher order differentiation of given composite function.

Ascend GPU CPU

None

mindspore.ops.stop_gradient

StopGradient is used for eliminating the effect of a value on the gradient, such as truncating the gradient propagation from an output of a function.

Ascend GPU CPU

None

Debugging Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.print_

Outputs the inputs to stdout.

Ascend GPU CPU

None

mindspore.ops.tensordump

Save tensor in npy format.

Ascend

The parameter mode will no longer support the value 'all'.

Sparse Functions

Warning

These are experimental APIs that are subject to change or deletion.

API Name

Description

Supported Platforms

Warning

mindspore.ops.dense_to_sparse_coo

Convert a Tensor to COOTensor.

GPU

None

mindspore.ops.dense_to_sparse_csr

Convert a Tensor to CSRTensor.

GPU

None

mindspore.ops.csr_to_coo

Converts a CSRTensor to COOTensor.

Ascend GPU CPU

None

COO Functions

Warning

These are experimental APIs that are subject to change or deletion.

API Name

Description

Supported Platforms

Warning

mindspore.ops.coo_abs

Returns coo_absolute value of a COOTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_acos

Computes arccosine of input coo_tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_acosh

Computes inverse hyperbolic cosine of the inputs element-wise.

Ascend GPU CPU

Given an input COOTensor x, the function computes inverse hyperbolic cosine of every element. Input range is [1, inf].

mindspore.ops.coo_add

Computes the sum of x1(COOTensor) and x2(COOTensor), and return a new COOTensor based on the computed result and thresh.

GPU CPU

None

mindspore.ops.coo_asin

Computes arcsine of input coo_tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_asinh

Computes inverse hyperbolic sine of the input element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_atan

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

Ascend GPU CPU

None

mindspore.ops.coo_atanh

Computes inverse hyperbolic tangent of the input element-wise.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.coo_ceil

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

Ascend GPU CPU

None

mindspore.ops.coo_concat

concatenates the input SparseTensor(COO format) along the specified dimension.

CPU

This is an experimental API that is subjected to change or deletion. Only supported on CPU now.

mindspore.ops.coo_cos

Computes cosine of input element-wise.

Ascend GPU CPU

If use float64, there may be a problem of missing precision.

mindspore.ops.coo_cosh

Computes hyperbolic cosine of input element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_exp

Returns the element-wise exponential of a COOTensor.

Ascend GPU CPU

None

mindspore.ops.coo_expm1

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

Ascend GPU CPU

None

mindspore.ops.coo_floor

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

Ascend GPU CPU

None

mindspore.ops.coo_inv

Computes Reciprocal of input COOTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_isfinite

Determines which elements are finite for each position.

Ascend GPU CPU

None

mindspore.ops.coo_isinf

Determines which elements are inf or -inf for each position.

GPU CPU

None

mindspore.ops.coo_isnan

Determines which elements are NaN for each position.

Ascend GPU CPU

None

mindspore.ops.coo_log

Returns the natural logarithm of a COOTensor element-wise.

Ascend GPU CPU

If the input value of operator Log is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affacted.

mindspore.ops.coo_log1p

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

Ascend GPU CPU

None

mindspore.ops.coo_neg

Returns a COOTensor with coo_negative values of the input COOTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_relu

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

Ascend GPU CPU

None

mindspore.ops.coo_relu6

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

Ascend GPU CPU

None

mindspore.ops.coo_round

Returns half to even of a COOTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_sigmoid

Sigmoid activation function.

Ascend GPU CPU

None

mindspore.ops.coo_sin

Computes sine of the input element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_sinh

Computes hyperbolic sine of the input element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_softsign

Softsign activation function.

Ascend GPU CPU

None

mindspore.ops.coo_sqrt

Computes sqrt of a COOTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_square

Returns square of a COOTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_tan

Computes tangent of x element-wise.

Ascend GPU CPU

None

mindspore.ops.coo_tanh

Computes hyperbolic tangent of input element-wise.

Ascend GPU CPU

None

CSR Functions

Warning

These are experimental APIs that are subject to change or deletion.

API Name

Description

Supported Platforms

Warning

mindspore.ops.csr_abs

Returns csr_absolute value of a CSRTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_acos

Computes arccosine of input csr_tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_acosh

Computes inverse hyperbolic cosine of the inputs element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_add

Computes the linear combination of two input CSRTensors a and b.

GPU CPU

None

mindspore.ops.csr_asin

Computes arcsine of input csr_tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_asinh

Computes inverse hyperbolic sine of the input element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_atan

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

Ascend GPU CPU

None

mindspore.ops.csr_atanh

Computes inverse hyperbolic tangent of the input element-wise.

Ascend GPU CPU

This is an experimental API that is subject to change or deletion.

mindspore.ops.csr_ceil

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

Ascend GPU CPU

None

mindspore.ops.csr_cos

Computes cosine of input element-wise.

Ascend GPU CPU

Currently support data types float16 and float32. If use float64, there may be a problem of missing precision.

mindspore.ops.csr_cosh

Computes hyperbolic cosine of input element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_exp

Returns csr_exponential of a CSRTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_expm1

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

Ascend GPU CPU

None

mindspore.ops.csr_floor

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

Ascend GPU CPU

None

mindspore.ops.csr_inv

Computes Reciprocal of input CSRTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_isfinite

Determines which elements are finite for each position.

Ascend GPU CPU

None

mindspore.ops.csr_isinf

Determines which elements are inf or -inf for each position.

GPU CPU

None

mindspore.ops.csr_isnan

Determines which elements are NaN for each position.

Ascend GPU CPU

None

mindspore.ops.csr_log

Returns the natural logarithm of a CSRTensor element-wise.

Ascend GPU CPU

If the input value of operator Log is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affacted.

mindspore.ops.csr_log1p

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

Ascend GPU CPU

None

mindspore.ops.csr_mm

Return the matrix multiplication result of the right-multiply matrix (dense or CSRTensor) of the CSRTensor.

GPU

None

mindspore.ops.csr_neg

Returns a CSRTensor with csr_negative values of the input CSRTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_relu

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

Ascend GPU CPU

None

mindspore.ops.csr_relu6

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

Ascend GPU CPU

None

mindspore.ops.csr_round

Returns half to even of a CSRTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_sigmoid

Sigmoid activation function.

Ascend GPU CPU

None

mindspore.ops.csr_sin

Computes sine of the input element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_sinh

Computes hyperbolic sine of the input element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_softmax

Calculates the softmax of a CSRTensorMatrix.

GPU CPU

None

mindspore.ops.csr_softsign

Softsign activation function.

Ascend GPU CPU

None

mindspore.ops.csr_sqrt

Returns sqrt of a CSRTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_square

Returns square of a CSRTensor element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_tan

Computes tangent of x element-wise.

Ascend GPU CPU

None

mindspore.ops.csr_tanh

Computes hyperbolic tangent of input element-wise.

Ascend GPU CPU

None

MC2 Functions

Warning

These are experimental APIs that are subject to change or deletion.

API Name

Description

Supported Platforms

Warning

mindspore.ops.all_gather_matmul

In the TP segmentation scenario, allgather and matmul are fused, and communication and computational pipelines are parallelized within the fusion operator.

Ascend

This is an experimental API that is subject to change or deletion.

mindspore.ops.matmul_reduce_scatter

In the TP segmentation scenario, matmul and reducescatter are fused, and communication and computational pipelines are parallelized within the fusion operator.

Ascend

This is an experimental API that is subject to change or deletion.