mindspore.ops

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

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.

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

None

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 \times \prod(\text{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.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.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 \times \prod(\text{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

None

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

Applies hswish-type activation element-wise.

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.

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

Applies the Softshrink function element-wise.

Ascend GPU CPU

None

mindspore.ops.softsign

SoftSign activation function.

Ascend GPU CPU

None

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

None

mindspore.ops.random_categorical

Generates random samples from a given categorical distribution tensor.

Ascend GPU CPU

None

mindspore.ops.log_uniform_candidate_sampler

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

Ascend CPU

None

mindspore.ops.uniform_candidate_sampler

Uniform candidate sampler.

Ascend GPU CPU

None

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

Alias for mindspore.ops.interpolate() .

Ascend GPU CPU

None

Mathematical Functions

Element-wise Operations

API Name

Description

Supported Platforms

Warning

mindspore.ops.abs

Returns 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

Computes accumulation of all input tensors element-wise.

Ascend GPU

None

mindspore.ops.acos

Computes arccosine of input tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.arccos

Alias for mindspore.ops.acos() .

Ascend GPU CPU

None

mindspore.ops.acosh

Computes inverse hyperbolic cosine of the inputs element-wise.

Ascend GPU CPU

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

mindspore.ops.add

Adds other value to input Tensor.

Ascend GPU CPU

None

mindspore.ops.addcdiv

Performs the element-wise division of tensor tensor1 by tensor tensor2, multiply the result by the scalar value and add it to input data.

Ascend GPU CPU

None

mindspore.ops.addcmul

Performs the element-wise product of tensor tensor1 and tensor tensor2, multiply the result by the scalar value and add it to input data.

Ascend GPU CPU

None

mindspore.ops.addmv

Multiplies matrix mat and vector vec.

Ascend GPU CPU

None

mindspore.ops.addn

Computes addition of all input tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.angle

Returns the element-wise argument of a 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

Reshapes Tensor in inputs, every Tensor has at least one dimension after this operation.

Ascend GPU CPU

None

mindspore.ops.atleast_2d

Reshapes Tensor in inputs, every Tensor has at least 2 dimension after this operation.

Ascend GPU CPU

None

mindspore.ops.atleast_3d

Reshapes Tensor in inputs, every Tensor has at least 3 dimension after this operation.

Ascend GPU CPU

None

mindspore.ops.bessel_i0

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

GPU CPU

None

mindspore.ops.bessel_i0e

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

Ascend GPU CPU

None

mindspore.ops.bessel_i1

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

GPU CPU

None

mindspore.ops.bessel_i1e

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

Ascend GPU CPU

None

mindspore.ops.bessel_j0

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

GPU CPU

None

mindspore.ops.bessel_j1

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

GPU CPU

None

mindspore.ops.bessel_k0

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

GPU CPU

None

mindspore.ops.bessel_k0e

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

GPU CPU

None

mindspore.ops.bessel_k1

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

GPU CPU

None

mindspore.ops.bessel_k1e

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

GPU CPU

None

mindspore.ops.bessel_y0

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

GPU CPU

None

mindspore.ops.bessel_y1

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

GPU CPU

None

mindspore.ops.bitwise_and

Returns bitwise and of two tensors element-wise.

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

Returns bitwise or of two tensors element-wise.

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

Returns bitwise xor of two tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.ceil

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

Ascend GPU CPU

None

mindspore.ops.clamp

Clamps tensor values between the specified minimum value and maximum value.

Ascend GPU CPU

None

mindspore.ops.clip

Alias for mindspore.ops.clamp() .

Ascend GPU CPU

None

mindspore.ops.combinations

Returns all r-length subsequences of input Tensor.

Ascend GPU CPU

None

mindspore.ops.copysign

Create a new floating-point tensor with the magnitude of x and the sign of other, element-wise.

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 x1 and x2 along the axis, dim.

Ascend GPU CPU

None

mindspore.ops.cov

Given the input and weights, returns the covariance matrix (the square matrix of the covariance of each pair of variables) of input, where the input row is the variable and the column is the observation value.

Ascend GPU CPU

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

mindspore.ops.diag_embed

Creates a tensor with diagonals filled by input.

Ascend GPU CPU

None

mindspore.ops.diff

Computes the n-th discrete difference along a specified axis of a given input x.

Ascend GPU CPU

None

mindspore.ops.deg2rad

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

Ascend GPU CPU

None

mindspore.ops.digamma

Computes the derivative of the lgamma function on input.

GPU CPU

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

mindspore.ops.div

Divides 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

Computes the Gauss error function of input element-wise.

Ascend GPU CPU

None

mindspore.ops.erfc

Computes the complementary error function of input element-wise.

Ascend GPU CPU

None

mindspore.ops.erfinv

Returns the result of the inverse error function with input, which is defined in the range (-1, 1) as:

Ascend GPU CPU

None

mindspore.ops.exp

Returns exponential of a tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.exp2

Computes base two exponential of Tensor input element-wise.

Ascend GPU CPU

None

mindspore.ops.expm1

Returns exponential then minus 1 of a tensor 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

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

Ascend GPU CPU

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

mindspore.ops.floor_mod

Computes the remainder of division element-wise.

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 exceeds 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 input to the power of the exponent.

GPU CPU

None

mindspore.ops.fmod

Computes the floating-point remainder of the division operation input/other.

Ascend GPU CPU

None

mindspore.ops.frac

Calculates the fractional part of each element in the input

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

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

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

Returns a new tensor containing imaginary value of the input.

Ascend GPU CPU

None

mindspore.ops.i0

Alias for mindspore.ops.bessel_i0() .

GPU CPU

None

mindspore.ops.inv

Computes Reciprocal of input tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.invert

Flips 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 \(2^{other}\) 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

Returns the natural logarithm of a 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

Returns a new Tensor by taking the base 2 logarithm of the elements in the input Tensor.

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

Returns a new Tensor by taking the base 10 logarithm of the elements in the input Tensor.

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

Returns the natural logarithm of one plus the input tensor 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

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

Ascend GPU CPU

None

mindspore.ops.logical_not

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

Ascend GPU CPU

None

mindspore.ops.logical_or

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

Ascend GPU CPU

None

mindspore.ops.logical_xor

Computes 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

Returns the results of 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.

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

Calculates 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

Returns 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

Computes the remainder of dividing the first input tensor by the second 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

Returns half to even of a tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.rsqrt

Computes 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

Returns 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

Computes sine of the input element-wise.

Ascend GPU CPU

None

mindspore.ops.sinc

Computes the normalized sinc of input.

Ascend GPU CPU

None

mindspore.ops.sinh

Computes hyperbolic sine of the input element-wise.

Ascend GPU CPU

None

mindspore.ops.sqrt

Returns sqrt of a tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.square

Returns square of a tensor element-wise.

Ascend GPU CPU

None

mindspore.ops.sub

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

Ascend GPU CPU

None

mindspore.ops.subtract

Performs the element-wise subtract of input tensors.

Ascend GPU CPU

None

mindspore.ops.t

Transposes a 2-D Tensor.

Ascend GPU CPU

None

mindspore.ops.tan

Computes tangent of input element-wise.

Ascend GPU CPU

None

mindspore.ops.tanhshrink

Tanhshrink Activation, \(Tanhshrink(x)=x-Tanh(x)\) , where \(x\) corresponds to input .

Ascend GPU CPU

None

mindspore.ops.trapz

Integrates y(x) along given dim using trapezoidal rule.

Ascend GPU CPU

None

mindspore.ops.tril_indices

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

Ascend GPU CPU

None

mindspore.ops.triu_indices

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

Ascend GPU CPU

None

mindspore.ops.true_divide

Alias for mindspore.ops.div() with \(rounding\_mode=None\).

Ascend GPU CPU

None

mindspore.ops.trunc

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

Ascend GPU CPU

None

mindspore.ops.truncate_div

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

Ascend GPU CPU

None

mindspore.ops.truncate_mod

Returns 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

Reduces a dimension of input by the "logical AND" of all elements in the dimension, by default.

Ascend GPU CPU

None

mindspore.ops.amax

Reduces all dimensions of a tensor by returning the maximum value in input, by default.

Ascend GPU CPU

None

mindspore.ops.amin

Reduces all dimensions of a tensor by returning the minimum value in input, by default.

Ascend GPU CPU

None

mindspore.ops.aminmax

It returns the minimum and maximum value along the given axis of input tensor.

Ascend GPU CPU

None

mindspore.ops.any

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

Ascend GPU CPU

None

mindspore.ops.argmax

Return the indices of the maximum values of a tensor across a dimension.

Ascend GPU CPU

None

mindspore.ops.argmin

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

Ascend GPU CPU

None

mindspore.ops.cummax

Returns a tuple (values,indices) where 'values' is the cumulative maximum value of input Tensor input along the dimension axis, and indices is the index location of each maximum value.

GPU CPU

None

mindspore.ops.cummin

Returns a tuple (values,indices) where 'values' is the cumulative minimum value of input Tensor input along the dimension axis, and indices is the index location of each minimum value.

Ascend GPU CPU

None

mindspore.ops.cumprod

Computes the cumulative product of the input tensor along dimension dim.

Ascend GPU CPU

None

mindspore.ops.cumsum

Computes the cumulative sum of input Tensor along axis.

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

Compute the cumulative log-sum-exp of the input tensor input along axis .

Ascend CPU GPU

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

mindspore.ops.logsumexp

Reduces a dimension of a tensor by calculating exponential for all elements in the dimension, then calculate logarithm of the sum.

Ascend GPU CPU

None

mindspore.ops.max

Calculates the maximum value along with the given axis for the input tensor.

Ascend GPU CPU

If there are multiple maximum values, the index of the first maximum value is used. The value range of "axis" is [-dims, dims - 1]. "dims" is the dimension length of "input".

mindspore.ops.mean

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

Ascend GPU CPU

None

mindspore.ops.median

Computes the median and indices of input tensor.

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

Calculates the minimum value along with the given axis for the input tensor.

Ascend GPU CPU

If there are multiple minimum values, the index of the first minimum value is used. The value range of "axis" is [-dims, dims - 1]. "dims" is the dimension length of "x".

mindspore.ops.norm

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

Ascend GPU CPU

None

mindspore.ops.prod

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

Ascend GPU CPU

None

mindspore.ops.std

Returns the standard-deviation of each row of the input Tensor by default, or it can calculate them in specified dimension axis.

Ascend GPU CPU

None

mindspore.ops.std_mean

Returns the standard-deviation and mean of each row of the input Tensor by default, or it can calculate them in specified dimension axis.

Ascend GPU CPU

None

mindspore.ops.var

Returns the variance of each row of the input Tensor by default, or it can calculate them in specified dimension axis.

Ascend GPU CPU

None

mindspore.ops.var_mean

Returns the variance and mean of each row of the input Tensor by default, or it can calculate them in specified dimension axis.

Ascend GPU CPU

None

Comparison Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.argsort

Sorts the input tensor along the given dimension in specified order and return the sorted indices.

Ascend GPU CPU

None

mindspore.ops.approximate_equal

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

Ascend GPU CPU

None

mindspore.ops.bucketize

Bucketizes input based on boundaries.

Ascend GPU CPU

None

mindspore.ops.eq

Computes the equivalence between two tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.equal

Computes the equivalence between two tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.ge

Computes the boolean value of \(input >= other\) element-wise.

Ascend GPU CPU

None

mindspore.ops.greater

Compare the value of the input parameters \(input > other\) element-wise, and the output result is a bool value.

Ascend GPU CPU

None

mindspore.ops.greater_equal

Given two Tensors, compares them element-wise to check if each element in the first Tensor is greater than or equal to the corresponding element in the second Tensor.

Ascend GPU CPU

None

mindspore.ops.gt

Compare the value of the input parameters \(input,other\) element-wise, and the output result is a bool value.

Ascend GPU CPU

None

mindspore.ops.intopk

Determines whether the targets are in the top k predictions.

Ascend GPU CPU

None

mindspore.ops.isclose

Returns a new Tensor with boolean elements representing if each element of input is “close” to the corresponding element of other.

Ascend GPU CPU

None

mindspore.ops.isfinite

Determine which elements are finite for each position.

Ascend GPU CPU

None

mindspore.ops.isinf

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

Ascend GPU CPU

None

mindspore.ops.isnan

Determines which elements are NaN for each position.

Ascend GPU CPU

None

mindspore.ops.isneginf

Tests element-wise for negative infinity.

Ascend GPU CPU

None

mindspore.ops.isposinf

Tests element-wise for positive infinity.

Ascend GPU CPU

None

mindspore.ops.isreal

Tests element-wise for real number.

GPU CPU

None

mindspore.ops.is_complex

Return True if the data type of the tensor is complex, otherwise return False.

Ascend GPU CPU

None

mindspore.ops.is_floating_point

Judge whether the data type of input is a floating point data type i.e., one of mindspore.float64, mindspore.float32, mindspore.float16.

Ascend GPU CPU

None

mindspore.ops.le

Computes the boolean value of \(input <= other\) element-wise.

Ascend GPU CPU

None

mindspore.ops.less

Computes the boolean value of \(input < other\) element-wise.

Ascend GPU CPU

None

mindspore.ops.less_equal

Computes the boolean 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

Computes the maximum of input tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.minimum

Computes the minimum of input tensors element-wise.

Ascend GPU CPU

None

mindspore.ops.msort

Sorts the elements in Tensor in ascending order of value along its first dimension.

Ascend GPU CPU

None

mindspore.ops.ne

Computes the non-equivalence of two tensors 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 such that after inserting the values into the sorted_sequence, the order of innermost dimension of the sorted_sequence remains unchanged.

Ascend GPU CPU

None

mindspore.ops.topk

Finds values and indices of the k largest or smallest entries along a given 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

Returns 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

Returns 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

Computes the eigenvalues of a square matrix(batch square matrices).

Ascend CPU

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

mindspore.ops.geqrf

Decomposes a matrix into the product of an orthogonal matrix Q and an upper triangular matrix R.

Ascend GPU CPU

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

mindspore.ops.ger

Ger product of input and vec2.

Ascend GPU CPU

None

mindspore.ops.inner

Returns the inner product of two tensors.

Ascend GPU CPU

None

mindspore.ops.inverse

Compute the inverse of the input matrix.

GPU CPU

None

mindspore.ops.kron

Computes the Kronecker product \(input ⊗ other\), denoted by ⊗, of input and other.

Ascend GPU CPU

None

mindspore.ops.logdet

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

CPU

None

mindspore.ops.lu_solve

Computes the solution y to the system of linear equations \(Ay = b\) , given LU decomposition \(A\) and column vector \(b\).

Ascend GPU CPU

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

mindspore.ops.lu_unpack

Converts LU_data and LU_pivots back into P, L and U matrices, where P is a permutation matrix, L is a lower triangular matrix, and U is an upper triangular matrix.

GPU CPU

None

mindspore.ops.matmul

Returns 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

Returns 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

Returns the diagonal part of input tensor.

Ascend GPU CPU

None

mindspore.ops.matrix_set_diag

Returns a batched matrix tensor with new batched diagonal values.

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

Return outer product of input and vec2.

Ascend GPU CPU

None

mindspore.ops.ormqr

Calculates two matrices multiplication of a product of a general matrix with Householder matrices.

GPU

None

mindspore.ops.orgqr

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

Ascend GPU CPU

None

mindspore.ops.ormqr

Calculates two matrices multiplication of a product of a general matrix with Householder matrices.

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.

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

Returns a new tensor that is the sum of the input main trace.

Ascend GPU CPU

None

mindspore.ops.tensor_dot

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

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 across 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 is a triangular-shaped weighting function used for smoothing or frequency analysis of signals in digital signal processing.

Ascend GPU CPU

None

mindspore.ops.blackman_window

Blackman window function, usually used to extract finite signal segment for FFT.

Ascend GPU CPU

None

mindspore.ops.hamming_window

Returns the Hamming window.

Ascend GPU CPU

None

mindspore.ops.hann_window

Generates a Hann Window.

Ascend GPU CPU

None

mindspore.ops.kaiser_window

Generates a Kaiser window, which is also known as the Kaiser-Bessel window.

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

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

Ascend GPU CPU

None

mindspore.ops.fill

Create a Tensor of the specified shape and fill it with the specified value.

Ascend GPU CPU

None

mindspore.ops.full

Create a Tensor of the specified shape and fill it with the specified value.

Ascend GPU CPU

None

mindspore.ops.full_like

Return a Tensor of the same shape as input and filled with fill_value.

Ascend GPU CPU

None

mindspore.ops.linspace

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

Ascend GPU CPU

None

mindspore.ops.logspace

Returns a 1-D Tensor with size steps whose value is from \(base^{start}\) to \(base^{end}\), and use base as the base number.

Ascend GPU CPU

None

mindspore.ops.one_hot

Computes a one-hot tensor.

Ascend GPU CPU

None

mindspore.ops.ones

Creates a tensor filled with value ones, whose shape and type are described by the first argument size and second argument dtype respectively.

Ascend GPU CPU

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

mindspore.ops.ones_like

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

Ascend GPU CPU

None

mindspore.ops.arange

Creates a sequence of numbers that begins at start and extends by increments of step up to but not including end.

Ascend GPU CPU

None

mindspore.ops.range

Creates a sequence of numbers that begins at start and extends by increments of step up to but not including end.

GPU CPU

None

mindspore.ops.zeros

Creates a tensor filled with value zeros, whose shape and type are described by the first argument size and second argument dtype respectively.

Ascend GPU CPU

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

mindspore.ops.zeros_like

Creates a tensor filled with 0, with the same size as input, and the given dtype.

Ascend GPU CPU

None

mindspore.ops.heaviside

Computes the Heaviside step function for each element in input.

Ascend GPU CPU

None

Randomly Generating Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.bernoulli

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

GPU CPU

None

mindspore.ops.gamma

Generates random numbers according to the Gamma random number distribution.

Ascend

None

mindspore.ops.laplace

Generates random numbers according to the Laplace random number distribution.

Ascend GPU CPU

None

mindspore.ops.multinomial

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

Ascend GPU CPU

None

mindspore.ops.multinomial_with_replacement

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

CPU

None

mindspore.ops.rand

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

Ascend GPU CPU

None

mindspore.ops.rand_like

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

Ascend GPU CPU

None

mindspore.ops.randint

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

Ascend GPU CPU

None

mindspore.ops.randint_like

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

Ascend GPU CPU

None

mindspore.ops.randn

Returns a new Tensor with given shape and dtype, filled with a sample (or samples) from the standard normal distribution.

Ascend GPU CPU

None

mindspore.ops.randn_like

Returns a new Tensor with given shape and dtype, filled with a sample (or samples) from the standard normal distribution.

Ascend GPU CPU

None

mindspore.ops.random_gamma

Outputs random values from the Gamma distribution(s) described by alpha.

CPU

None

mindspore.ops.random_poisson

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

GPU CPU

None

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.

mindspore.ops.standard_laplace

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

Ascend GPU CPU

None

mindspore.ops.standard_normal

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

Ascend GPU CPU

None

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 the positions of all non-zero values.

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

Counts the number of occurrences of each value in input.

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 \((*, \frac{C}{g}, g, H*W)\), while keeping the original tensor shapes.

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

Ascend GPU CPU

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

Constructs a diagonal tensor with a given diagonal values.

Ascend GPU CPU

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

mindspore.ops.diagflat

Create a 2-D Tensor which diagonal is the flattened input .

Ascend GPU CPU

None

mindspore.ops.diagonal

Returns specified diagonals of input.

Ascend GPU CPU

None

mindspore.ops.diagonal_scatter

dim1 and dim2 specify the two dimensions of input, the elements in these two dimensions will be treated as elements of a matrix, and src is embedded on the diagonal of the matrix.

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 into multiple sub-tensors 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 dimension to input_x at the given axis, the dimension of input_x should be greater than or equal to 1.

Ascend GPU CPU

None

mindspore.ops.flip

Reverses the order of elements in a tensor along the given axis.

Ascend GPU CPU

None

mindspore.ops.fliplr

Flips the elements of each row in the left/right direction, while preserving the columns of the input tensor.

Ascend GPU CPU

None

mindspore.ops.flipud

Flips the elements of each column in the up/down direction, while preserving the rows of the input tensor.

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 an axis specified by dim.

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 a tensor by 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

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

Ascend GPU CPU

None

mindspore.ops.index_fill

Fills the elements under the axis dimension of the input Tensor x with the input value by selecting the indices in the order given in index.

Ascend GPU CPU

None

mindspore.ops.index_select

Generates a new Tensor that accesses the values of input along the specified axis dimension using the indices specified in index.

Ascend GPU CPU

None

mindspore.ops.inplace_add

Adds v into specified rows of x.

Ascend GPU CPU

None

mindspore.ops.inplace_index_add

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

Ascend CPU

None

mindspore.ops.inplace_sub

Subtracts v into specified rows of x.

Ascend GPU CPU

None

mindspore.ops.inplace_update

Updates specified values in x to v according to 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

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

Ascend GPU CPU

None

mindspore.ops.meshgrid

Generates coordinate matrices from given coordinate tensors.

Ascend GPU CPU

None

mindspore.ops.narrow

Returns a narrowed tensor from input tensor, and the dimension axis is input from start to start + length.

Ascend GPU CPU

None

mindspore.ops.moveaxis

Alias for ops.movedim.

Ascend GPU CPU

None

mindspore.ops.movedim

Moves axis of an array from source to destination.

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

None

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, treating NaNs as zero.

Ascend GPU CPU

None

mindspore.ops.normal

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

Ascend GPU CPU

None

mindspore.ops.nonzero

Return the positions of all non-zero values.

Ascend GPU CPU

None

mindspore.ops.numel

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

Ascend GPU CPU

None

mindspore.ops.permute

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

Ascend GPU CPU

None

mindspore.ops.population_count

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

Ascend GPU CPU

None

mindspore.ops.rank

Returns the rank of a tensor.

Ascend GPU CPU

None

mindspore.ops.repeat_elements

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

Ascend GPU CPU

None

mindspore.ops.repeat_interleave

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

Ascend GPU CPU

None

mindspore.ops.reshape

Rearranges the input Tensor based on the given shape.

Ascend GPU CPU

None

mindspore.ops.reverse

mindspore.ops.reverse() will be deprecated in the future.

Ascend GPU CPU

None

mindspore.ops.reverse_sequence

Reverses variable length slices.

Ascend GPU CPU

None

mindspore.ops.roll

Rolls the elements of a tensor along an axis.

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

Returns the shape of the input tensor.

Ascend GPU CPU

None

mindspore.ops.shuffle

Randomly shuffles a Tensor along its first dimension.

Ascend GPU CPU

None

mindspore.ops.size

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

Ascend GPU CPU

None

mindspore.ops.slice

Slices a tensor in the specified shape.

Ascend GPU CPU

None

mindspore.ops.slice_scatter

Slice the input Tensor in the specified dimension and overlay the slice results with the source Tensor.

Ascend GPU CPU

None

mindspore.ops.sort

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

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 a Tensor such that \(output_i = \frac{\sum_j x_{indices[j]}}{N}\) where mean is over \(j\) such that \(segment\_ids[j] == i\) and \(N\) is the total number of values summed.

GPU CPU

None

mindspore.ops.split

Splits the Tensor into chunks along the given axis.

Ascend GPU CPU

None

mindspore.ops.squeeze

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

Ascend GPU CPU

None

mindspore.ops.stack

Stacks a list of 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

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

Ascend GPU CPU

None

mindspore.ops.tensor_scatter_div

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

GPU CPU

None

mindspore.ops.tensor_scatter_max

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

GPU CPU

None

mindspore.ops.tensor_scatter_min

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

Ascend GPU CPU

None

mindspore.ops.tensor_scatter_mul

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

GPU CPU

None

mindspore.ops.tensor_scatter_sub

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

Ascend GPU CPU

None

mindspore.ops.tensor_scatter_elements

Write all elements in updates to the index specified by indices in input_x according to the reduction operation specified by reduction.

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

Splits a tensor into multiple sub-tensors along the given axis.

Ascend GPU CPU

None

mindspore.ops.tile

Creates a new tensor by replicating input dims times.

Ascend GPU CPU

None

mindspore.ops.tril

Returns the lower triangle part of 'input' (elements that contain the diagonal and below), and set the other elements to zeros.

Ascend GPU CPU

None

mindspore.ops.triu

Returns the upper triangle part of 'input' (elements that contain the diagonal and below), and set the other elements to zeros.

Ascend GPU CPU

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

mindspore.ops.transpose

Permutes the 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 \times \prod(\text{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.

Ascend GPU CPU

None

mindspore.ops.unsorted_segment_max

Computes the maximum along segments of a tensor.

Ascend GPU CPU

None

mindspore.ops.unsorted_segment_min

Computes the minimum of a tensor along segments.

Ascend GPU CPU

None

mindspore.ops.unsorted_segment_prod

Computes the product of a tensor along segments.

Ascend GPU CPU

None

mindspore.ops.unsorted_segment_sum

Computes the sum of a tensor along segments.

Ascend GPU CPU

None

mindspore.ops.unsqueeze

Adds an additional dimension to input at the given dim.

Ascend GPU CPU

None

mindspore.ops.unstack

Unstacks tensor in specified axis, this is the opposite of mindspore.ops.stack().

Ascend GPU CPU

None

mindspore.ops.view_as_real

View a complex Tensor as a real Tensor.

GPU CPU

None

mindspore.ops.vsplit

Splits input 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

Selects elements from input or other based on condition and returns a tensor.

Ascend GPU CPU

None

mindspore.ops.cross

Computes the cross product of input and other in dimension dim.

Ascend CPU

None

mindspore.ops.renorm

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

Ascend GPU CPU

None

Type Cast

API Name

Description

Supported Platforms

Warning

mindspore.ops.is_tensor

Check whether the input object is a 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, and converts the data type to the specified type.

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

Clip norm of a set of input Tensors.

Ascend GPU CPU

None

Parameter Operation Functions

API Name

Description

Supported Platforms

Warning

mindspore.ops.assign

Assigns Parameter with a value.

Ascend GPU CPU

None

mindspore.ops.assign_add

Updates a Parameter by adding a value to it.

Ascend GPU CPU

None

mindspore.ops.assign_sub

Updates a Parameter by subtracting a value from it.

Ascend GPU CPU

None

mindspore.ops.scatter_add

Using given values to update tensor value through the add operation, along with the input indices.

Ascend GPU CPU

None

mindspore.ops.scatter_div

Using given values to update tensor value through the div operation, along with the input indices.

Ascend GPU CPU

None

mindspore.ops.scatter_min

Using given values to update tensor value through the min operation, along with the input indices.

Ascend GPU CPU

None

mindspore.ops.scatter_max

Using given values to update tensor value through the max operation, along with the input indices.

Ascend GPU CPU

None

mindspore.ops.scatter_mul

Using given values to update tensor value through the mul operation, along with the input indices.

Ascend GPU CPU

None

mindspore.ops.scatter_nd_add

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

Ascend GPU CPU

None

mindspore.ops.scatter_nd_div

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

GPU CPU

None

mindspore.ops.scatter_nd_max

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

Ascend GPU CPU

None

mindspore.ops.scatter_nd_min

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

Ascend GPU CPU

None

mindspore.ops.scatter_nd_mul

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

GPU CPU

None

mindspore.ops.scatter_nd_sub

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

Ascend GPU CPU

None

mindspore.ops.scatter_update

Updates tensor values by using input indices and value.

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

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

Returns 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