mindspore.ops.function

Neural Network Layer Functions

Neural Network

API Name

Description

Supported Platforms

mindspore.ops.adaptive_avg_pool2d

2D adaptive average pooling for temporal data.

GPU

mindspore.ops.adaptive_avg_pool3d

3D adaptive average pooling for temporal data.

GPU

mindspore.ops.avg_pool2d

Average pooling operation.

Ascend GPU CPU

mindspore.ops.bias_add

Returns the sum of the input_x and the bias Tensor.

Ascend GPU CPU

mindspore.ops.conv2d

2D convolution layer.

Ascend GPU CPU

mindspore.ops.ctc_greedy_decoder

Performs greedy decoding on the logits given in inputs.

Ascend CPU

mindspore.ops.deformable_conv2d

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

Ascend GPU CPU

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

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

mindspore.ops.flatten

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

Ascend GPU CPU

mindspore.ops.interpolate

Using the interpolate method specified by mode resize the input tensor x.

Ascend CPU GPU

mindspore.ops.lrn

Local Response Normalization.

Ascend GPU CPU

mindspore.ops.max_pool3d

Performs a 3D max pooling on the input Tensor.

GPU

mindspore.ops.kl_div

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

Ascend GPU CPU

mindspore.ops.pad

Pads the input tensor according to the paddings.

Ascend GPU CPU

mindspore.ops.padding

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

Ascend GPU CPU

Loss Functions

API Name

Description

Supported Platforms

mindspore.ops.binary_cross_entropy_with_logits

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

Ascend GPU CPU

mindspore.ops.cross_entropy

The cross entropy loss between input and target.

Ascend GPU CPU

mindspore.ops.nll_loss

Gets the negative log likelihood loss between inputs and target.

Ascend GPU CPU

mindspore.ops.smooth_l1_loss

Computes smooth L1 loss, a robust L1 loss.

Ascend GPU CPU

Activation Functions

API Name

Description

Supported Platforms

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

mindspore.ops.fast_gelu

Fast Gaussian Error Linear Units activation function.

Ascend GPU CPU

mindspore.ops.gumbel_softmax

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

Ascend GPU CPU

mindspore.ops.hardshrink

Hard Shrink activation function.

Ascend GPU CPU

mindspore.ops.hardswish

Hard swish activation function.

Ascend GPU CPU

mindspore.ops.log_softmax

Log Softmax activation function.

Ascend GPU CPU

mindspore.ops.mish

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

Ascend GPU CPU

mindspore.ops.selu

Activation function SeLU (Scaled exponential Linear Unit).

Ascend GPU CPU

mindspore.ops.softsign

Softsign activation function.

Ascend GPU CPU

mindspore.ops.soft_shrink

Applies the SoftShrink function element-wise.

Ascend CPU GPU

mindspore.ops.softmax

Softmax operation.

Ascend GPU CPU

mindspore.ops.tanh

Tanh activation function.

Ascend GPU CPU

Sampling Functions

API Name

Description

Supported Platforms

mindspore.ops.grid_sample

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

Ascend GPU

mindspore.ops.uniform_candidate_sampler

Uniform candidate sampler.

Ascend GPU CPU

Distance Functions

API Name

Description

Supported Platforms

mindspore.ops.cdist

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

Ascend CPU

Image Functions

API Name

Description

Supported Platforms

mindspore.ops.iou

Calculates intersection over union for boxes.

Ascend GPU CPU

Element-by-Element Operations

API Name

Description

Supported Platforms

mindspore.ops.abs

Returns absolute value of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.acos

Computes arccosine of input tensors element-wise.

Ascend GPU CPU

mindspore.ops.acosh

Computes inverse hyperbolic cosine of the inputs element-wise.

Ascend GPU CPU

mindspore.ops.add

Adds two input tensors element-wise.

Ascend GPU CPU

mindspore.ops.addcdiv

Performs the element-wise division of tensor x1 by tensor x2, multiply the result by the scalar value and add it to input_data.

Ascend GPU CPU

mindspore.ops.addcmul

Performs the element-wise product of tensor x1 and tensor x2, multiply the result by the scalar value and add it to input_data.

Ascend GPU

mindspore.ops.addn

Computes addition of all input tensors element-wise.

Ascend GPU CPU

mindspore.ops.asin

Computes arcsine of input tensors element-wise.

Ascend GPU CPU

mindspore.ops.asinh

Computes inverse hyperbolic sine of the input element-wise.

Ascend GPU CPU

mindspore.ops.atan

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

Ascend GPU CPU

mindspore.ops.atan2

Returns arctangent of x/y element-wise.

Ascend CPU GPU

mindspore.ops.atanh

Computes inverse hyperbolic tangent of the input element-wise.

Ascend GPU CPU

mindspore.ops.bernoulli

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

GPU

mindspore.ops.bessel_i0

Computes the Bessel i0 function of x element-wise.

GPU CPU

mindspore.ops.bessel_i0e

Computes the Bessel i0e function of x element-wise.

Ascend GPU CPU

mindspore.ops.bessel_i1

Computes the Bessel i1 function of x element-wise.

GPU CPU

mindspore.ops.bessel_i1e

Computes the Bessel i1e function of x element-wise.

Ascend GPU CPU

mindspore.ops.bessel_j0

Computes the Bessel j0 function of x element-wise.

GPU CPU

mindspore.ops.bessel_j1

Computes the Bessel j1 function of x element-wise.

GPU CPU

mindspore.ops.bessel_k0

Computes the Bessel k0 function of x element-wise.

GPU CPU

mindspore.ops.bessel_k0e

Computes the Bessel k0e function of x element-wise.

GPU CPU

mindspore.ops.bessel_k1

Computes the Bessel k1 function of x element-wise.

GPU CPU

mindspore.ops.bessel_k1e

Computes the Bessel k1e function of x element-wise.

GPU CPU

mindspore.ops.bessel_y0

Computes the Bessel y0 function of x element-wise.

GPU CPU

mindspore.ops.bessel_y1

Computes the Bessel y1 function of x element-wise.

GPU CPU

mindspore.ops.bitwise_and

Returns bitwise and of two tensors element-wise.

Ascend GPU CPU

mindspore.ops.bitwise_or

Returns bitwise or of two tensors element-wise.

Ascend GPU CPU

mindspore.ops.bitwise_xor

Returns bitwise xor of two tensors element-wise.

Ascend GPU CPU

mindspore.ops.ceil

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

Ascend GPU CPU

mindspore.ops.cos

Computes cosine of input element-wise.

Ascend GPU CPU

mindspore.ops.cosh

Computes hyperbolic cosine of input element-wise.

Ascend GPU CPU

mindspore.ops.div

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

Ascend GPU CPU

mindspore.ops.erf

Computes the Gauss error function of x element-wise.

Ascend GPU CPU

mindspore.ops.erfc

Computes the complementary error function of x element-wise.

Ascend GPU CPU

mindspore.ops.exp

Returns exponential of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.expm1

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

Ascend GPU CPU

mindspore.ops.floor

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

Ascend GPU CPU

mindspore.ops.floor_div

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

Ascend GPU CPU

mindspore.ops.floor_mod

Computes the remainder of division element-wise.

Ascend GPU CPU

mindspore.ops.inv

Computes Reciprocal of input tensor element-wise.

Ascend GPU CPU

mindspore.ops.invert

Flips all bits of input tensor element-wise.

Ascend GPU CPU

mindspore.ops.lerp

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

Ascend GPU CPU

mindspore.ops.log

Returns the natural logarithm of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.log1p

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

Ascend GPU CPU

mindspore.ops.logical_and

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

Ascend GPU CPU

mindspore.ops.logical_not

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

Ascend GPU CPU

mindspore.ops.logical_or

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

Ascend GPU CPU

mindspore.ops.mul

Multiplies two tensors element-wise.

Ascend GPU CPU

mindspore.ops.neg

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

Ascend GPU CPU

mindspore.ops.pow

Calculates the y power of each element in x.

Ascend GPU CPU

mindspore.ops.round

Returns half to even of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.sin

Computes sine of the input element-wise.

Ascend GPU CPU

mindspore.ops.sinh

Computes hyperbolic sine of the input element-wise.

Ascend GPU CPU

mindspore.ops.square

Returns square of a tensor element-wise.

Ascend GPU CPU

mindspore.ops.sub

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

Ascend GPU CPU

mindspore.ops.tan

Computes tangent of x element-wise.

Ascend CPU GPU

mindspore.ops.trunc

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

Ascend GPU CPU

mindspore.ops.truncate_div

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

Ascend CPU GPU

mindspore.ops.truncate_mod

Returns the remainder of division element-wise.

Ascend CPU GPU

mindspore.ops.xdivy

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

Ascend GPU CPU

mindspore.ops.xlogy

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

Ascend GPU CPU

Reduction Functions

API Name

Description

Supported Platforms

mindspore.ops.amax

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

Ascend GPU CPU

mindspore.ops.amin

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

Ascend GPU CPU

mindspore.ops.argmin

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

Ascend GPU CPU

mindspore.ops.cummax

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

GPU CPU

mindspore.ops.cummin

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

Ascend GPU CPU

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

mindspore.ops.max

Calculates the maximum value with the corresponding index.

Ascend GPU CPU

mindspore.ops.mean

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

Ascend GPU CPU

mindspore.ops.min

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

Ascend GPU CPU

mindspore.ops.norm

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

Ascend GPU CPU

mindspore.ops.prod

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

Ascend GPU CPU

mindspore.ops.std

Returns the standard-deviation and mean of each row of the input tensor in the dimension axis.

Ascend CPU

function

Description

mindspore.ops.reduce_sum

Refer to mindspore.ops.ReduceSum.

Comparison Functions

API Name

Description

Supported Platforms

mindspore.ops.approximate_equal

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

Ascend GPU CPU

mindspore.ops.equal

Computes the equivalence between two tensors element-wise.

Ascend GPU CPU

mindspore.ops.ge

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

Ascend GPU CPU

mindspore.ops.gt

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

Ascend GPU CPU

mindspore.ops.intopk

Determines whether the targets are in the top k predictions.

Ascend GPU CPU

mindspore.ops.isclose

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

Ascend GPU CPU

mindspore.ops.isfinite

Determines which elements are finite for each position.

Ascend GPU CPU

mindspore.ops.isnan

Determines which elements are NaN for each position.

Ascend GPU CPU

mindspore.ops.le

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

Ascend GPU CPU

mindspore.ops.less

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

Ascend GPU CPU

mindspore.ops.maximum

Computes the maximum of input tensors element-wise.

Ascend GPU CPU

mindspore.ops.minimum

Computes the minimum of input tensors element-wise.

Ascend GPU CPU

mindspore.ops.ne

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

Ascend GPU CPU

mindspore.ops.same_type_shape

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

Ascend GPU CPU

function

Description

mindspore.ops.check_bprop

Refer to mindspore.ops.CheckBprop.

mindspore.ops.isinstance_

Refer to mindspore.ops.IsInstance.

mindspore.ops.issubclass_

Refer to mindspore.ops.IsSubClass.

Linear Algebraic Functions

API Name

Description

Supported Platforms

mindspore.ops.batch_dot

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

Ascend GPU CPU

mindspore.ops.dot

Computation a dot product between samples in two tensors.

Ascend GPU CPU

mindspore.ops.matmul

Returns the matrix product of two tensors.

Ascend GPU CPU

mindspore.ops.matrix_solve

Solves systems of linear equations.

GPU CPU

mindspore.ops.ger

Ger product of x1 and x2.

Ascend GPU CPU

mindspore.ops.renorm

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

Ascend CPU GPU

mindspore.ops.tensor_dot

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

Ascend GPU CPU

Tensor Operation Functions

Tensor Building

API Name

Description

Supported Platforms

mindspore.ops.eye

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

Ascend GPU CPU

mindspore.ops.fill

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

Ascend GPU CPU

mindspore.ops.linspace

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

Ascend GPU CPU

mindspore.ops.narrow

Returns a narrowed tensor from input tensor.

Ascend GPU CPU

mindspore.ops.one_hot

Computes a one-hot tensor.

Ascend GPU CPU

mindspore.ops.ones

Creates a tensor filled with value ones.

Ascend GPU CPU

mindspore.ops.ones_like

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

Ascend GPU CPU

Randomly Generating Functions

API Name

Description

Supported Platforms

mindspore.ops.gamma

Generates random numbers according to the Gamma random number distribution.

Ascend

mindspore.ops.laplace

Generates random numbers according to the Laplace random number distribution.

Ascend

mindspore.ops.multinomial

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

GPU

mindspore.ops.poisson

The ops.poisson is deprecated, please use mindspore.ops.random_poisson Generates random numbers according to the Poisson random number distribution.

deprecated

mindspore.ops.random_poisson

Generates random numbers according to the Poisson random number distribution.

CPU

mindspore.ops.random_categorical

Generates random samples from a given categorical distribution tensor.

Ascend GPU CPU

mindspore.ops.random_gamma

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

CPU

mindspore.ops.standard_laplace

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

Ascend GPU CPU

mindspore.ops.standard_normal

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

Ascend GPU CPU

mindspore.ops.uniform

Generates random numbers according to the Uniform random number distribution.

Ascend GPU CPU

Array Operation

API Name

Description

Supported Platforms

mindspore.ops.adaptive_max_pool2d

adaptive_max_pool2d operation.

Ascend GPU CPU

mindspore.ops.batch_to_space_nd

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

Ascend CPU

mindspore.ops.broadcast_to

Broadcasts input tensor to a given shape.

Ascend GPU CPU

mindspore.ops.col2im

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

GPU

mindspore.ops.concat

Connect tensor in the specified axis.

Ascend GPU CPU

mindspore.ops.count_nonzero

Count number of nonzero elements across axis of input tensor

Ascend GPU CPU

mindspore.ops.diag

Constructs a diagonal tensor with a given diagonal values.

Ascend GPU

mindspore.ops.expand_dims

Adds an additional dimension to input_x at the given axis.

Ascend GPU CPU

mindspore.ops.gather

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

Ascend GPU CPU

mindspore.ops.gather_d

Gathers elements along an axis specified by dim.

Ascend GPU CPU

mindspore.ops.gather_elements

Gathers elements along an axis specified by dim.

Ascend GPU CPU

mindspore.ops.gather_nd

Gathers slices from a tensor by indices.

Ascend GPU CPU

mindspore.ops.index_add

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

Ascend GPU CPU

mindspore.ops.index_fill

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

GPU

mindspore.ops.inplace_add

Adds v into specified rows of x.

Ascend CPU

mindspore.ops.inplace_sub

Subtracts v into specified rows of x.

Ascend CPU

mindspore.ops.inplace_update

Updates specified rows with values in v.

Ascend GPU CPU

mindspore.ops.masked_fill

Fills elements of Tensor with value where mask is True.

Ascend GPU CPU

mindspore.ops.masked_select

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

Ascend GPU CPU

mindspore.ops.matrix_band_part

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

GPU CPU

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

mindspore.ops.matrix_diag_part

Returns the diagonal part of input tensor.

Ascend GPU CPU

mindspore.ops.matrix_set_diag

Returns a batched matrix tensor with new batched diagonal values.

Ascend GPU CPU

mindspore.ops.meshgrid

Generates coordinate matrices from given coordinate tensors.

Ascend CPU GPU

mindspore.ops.normal

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

Ascend GPU CPU

mindspore.ops.nonzero

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

GPU`

mindspore.ops.population_count

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

Ascend GPU CPU

mindspore.ops.range

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

GPU CPU

mindspore.ops.rank

Returns the rank of a tensor.

Ascend GPU CPU

mindspore.ops.repeat_elements

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

Ascend GPU CPU

mindspore.ops.reshape

Rearranges the input Tensor based on the given shape.

Ascend GPU CPU

mindspore.ops.reverse_sequence

Reverses variable length slices.

Ascend GPU CPU

mindspore.ops.scatter_nd

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

Ascend GPU CPU

mindspore.ops.select

The conditional tensor determines whether the corresponding element in the output must be selected from \(x\) (if true) or \(y\) (if false) based on the value of each element.

Ascend GPU CPU

mindspore.ops.sequence_mask

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

GPU

mindspore.ops.shape

Returns the shape of the input tensor.

Ascend GPU CPU

mindspore.ops.size

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

Ascend GPU CPU

mindspore.ops.slice

Slices a tensor in the specified shape.

Ascend GPU CPU

mindspore.ops.space_to_batch_nd

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

Ascend CPU

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

mindspore.ops.split

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

Ascend GPU CPU

mindspore.ops.squeeze

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

Ascend GPU CPU

mindspore.ops.stack

Stacks a list of tensors in specified axis.

Ascend GPU CPU

mindspore.ops.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

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

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

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

mindspore.ops.tensor_scatter_elements

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

Ascend GPU CPU

mindspore.ops.tile

Replicates an input tensor with given multiples times.

Ascend GPU CPU

mindspore.ops.top_k

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

Ascend GPU CPU

mindspore.ops.transpose

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

Ascend GPU CPU

mindspore.ops.unique

Returns the unique elements of input tensor and also return a tensor containing the index of each value of input tensor corresponding to the output unique tensor.

Ascend GPU CPU

mindspore.ops.unique_consecutive

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

Ascend GPU

mindspore.ops.unique_with_pad

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

Ascend GPU CPU

mindspore.ops.unsorted_segment_max

Computes the maximum along segments of a tensor.

Ascend GPU CPU

mindspore.ops.unsorted_segment_min

Computes the minimum of a tensor along segments.

Ascend GPU CPU

mindspore.ops.unsorted_segment_prod

Computes the product of a tensor along segments.

Ascend GPU CPU

mindspore.ops.unsorted_segment_sum

Computes the sum of a tensor along segments.

Ascend GPU CPU

mindspore.ops.unstack

Unstacks tensor in specified axis.

Ascend GPU CPU

function

Description

mindspore.ops.cast

Refer to mindspore.ops.Cast.

mindspore.ops.cumprod

Refer to mindspore.ops.CumProd.

mindspore.ops.cumsum

Refer to mindspore.ops.CumSum.

mindspore.ops.dtype

Refer to mindspore.ops.DType.

mindspore.ops.sort

Refer to mindspore.ops.Sort.

mindspore.ops.strided_slice

Refer to mindspore.ops.StridedSlice.

mindspore.ops.tensor_scatter_update

Refer to mindspore.ops.TensorScatterUpdate.

Type Conversion

API Name

Description

Supported Platforms

mindspore.ops.scalar_cast

Casts the input scalar to another type.

Ascend GPU CPU

mindspore.ops.scalar_to_array

Converts a scalar to a Tensor.

Ascend GPU CPU

mindspore.ops.scalar_to_tensor

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

Ascend GPU CPU

mindspore.ops.tuple_to_array

Converts a tuple to a tensor.

Ascend GPU CPU

Sparse Functions

API Name

Description

Supported Platforms

mindspore.ops.dense_to_sparse_coo

Convert a Tensor to COOTensor.

GPU

mindspore.ops.dense_to_sparse_csr

Convert a Tensor to CSRTensor.

GPU

mindspore.ops.csr_to_coo

Converts a CSRTensor to COOTensor.

Ascend GPU CPU

Gradient Clipping

API Name

Description

Supported Platforms

mindspore.ops.clip_by_global_norm

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

Ascend GPU CPU

mindspore.ops.clip_by_value

Clips tensor values to a specified min and max.

Ascend GPU CPU

Parameter Operation Functions

API Name

Description

Supported Platforms

mindspore.ops.assign

Assigns Parameter with a value.

Ascend GPU CPU

mindspore.ops.assign_add

Updates a Parameter by adding a value to it.

Ascend GPU CPU

mindspore.ops.assign_sub

Updates a Parameter by subtracting a value from it.

Ascend GPU CPU

mindspore.ops.scatter_add

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

Ascend GPU CPU

mindspore.ops.scatter_div

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

Ascend GPU CPU

mindspore.ops.scatter_min

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

Ascend GPU CPU

mindspore.ops.scatter_max

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

Ascend CPU GPU

mindspore.ops.scatter_mul

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

Ascend GPU CPU

mindspore.ops.scatter_nd_add

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

Ascend GPU CPU

mindspore.ops.scatter_nd_div

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

GPU CPU

mindspore.ops.scatter_nd_max

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

Ascend GPU CPU

mindspore.ops.scatter_nd_min

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

Ascend GPU CPU

mindspore.ops.scatter_nd_mul

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

GPU CPU

mindspore.ops.scatter_nd_sub

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

Ascend GPU CPU

mindspore.ops.scatter_update

Updates tensor values by using input indices and value.

Ascend GPU CPU

Differential Functions

API Name

Description

Supported Platforms

mindspore.ops.derivative

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

Ascend GPU CPU

mindspore.ops.grad

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

Ascend GPU CPU

mindspore.ops.value_and_grad

A wrapper function to generate the function to calculate forward output and gradient for the input function.

Ascend GPU CPU

mindspore.ops.jet

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

Ascend GPU CPU

mindspore.ops.jvp

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

Ascend GPU CPU

mindspore.ops.vjp

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

Ascend GPU CPU

mindspore.ops.vmap

Vectorizing map (vmap) is a kind of higher-order function to map fn along the parameter axes.

Ascend GPU CPU

Other Functions

function

Description

mindspore.ops.bool_and

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

mindspore.ops.bool_eq

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

mindspore.ops.bool_not

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

mindspore.ops.bool_or

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

mindspore.ops.depend

Refer to mindspore.ops.Depend.

mindspore.ops.in_dict

Determine if a str in dict.

mindspore.ops.is_not

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

mindspore.ops.is_

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

mindspore.ops.isconstant

Determine whether the object is constant.

mindspore.ops.not_in_dict

Determine whether the object is not in the dict.

mindspore.ops.partial

Refer to mindspore.ops.Partial.

mindspore.ops.scalar_add

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

mindspore.ops.scalar_div

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

mindspore.ops.scalar_eq

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

mindspore.ops.scalar_floordiv

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

mindspore.ops.scalar_ge

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

mindspore.ops.scalar_gt

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

mindspore.ops.scalar_le

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

mindspore.ops.scalar_log

Get the natural logarithm of the input number.

mindspore.ops.scalar_lt

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

mindspore.ops.scalar_mod

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

mindspore.ops.scalar_mul

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

mindspore.ops.scalar_ne

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

mindspore.ops.scalar_pow

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

mindspore.ops.scalar_sub

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

mindspore.ops.scalar_uadd

Get the positive value of the input number.

mindspore.ops.scalar_usub

Get the negative value of the input number.

mindspore.ops.shape_mul

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

mindspore.ops.stop_gradient

Disable update during back propagation. (stop_gradient)

mindspore.ops.string_concat

Concatenate two strings.

mindspore.ops.string_eq

Determine if two strings are equal.

mindspore.ops.typeof

Get type of object.

API Name

Description

Supported Platforms

mindspore.ops.core

A decorator that adds a flag to the function.

Ascend GPU CPU