mindspore.ops
mindspore.ops provides a large number of function interfaces, including neural network functions, mathematical operation functions, Tensor operation functions, Parameter operation functions, differential functions and so on.
For more information about dynamic shape support status, please refer to Dynamic Shape Support Status of ops Interface .
The module import method is as follows:
from mindspore import ops
Compared with the previous version, the added, deleted and supported platforms change information of mindspore.ops operators in MindSpore, please refer to the link mindspore.ops API Interface Change.
Tensor Operation Functions
Tensor Creation
API Name |
Description |
Supported Platforms |
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. |
|
|
Returns a tensor with ones on the diagonal and zeros in the rest. |
|
|
Create a tensor filled with a specified value. |
|
|
Create a tensor filled with a specified value. |
|
|
Return a tensor of the same shape as input and filled with a specified value. |
|
|
Generate a one-dimensional tensor with steps elements, evenly distributed in the interval [start, end]. |
|
|
Return a tensor with steps elements, evenly distributed in the interval [ \(base^{start}\) , \(base^{end}\)]. |
|
|
Copy tensor to target device synchronously or asynchronously, default synchronously. |
|
|
Generate a new tensor, where the positions specified by indices are assigned on_value, and all other positions are assigned off_value. |
|
|
Creates a tensor filled with value ones. |
|
|
Return a tensor filled with 1, with the same size as input. |
|
|
Returns a tensor with a step length of step in the interval [ start , end ). |
|
|
Returns a tensor with a step length of step in the interval [ start , end ). |
|
|
Creates a tensor filled with value zeros. |
|
|
Return a tensor filled with 0, with the same size as input . |
|
|
Perform Heaviside step function element-wise. |
|
Randomly Generating Functions
API Name |
Description |
Supported Platforms |
Generates Bernoulli random values (0 or 1). |
|
|
Generates random numbers according to the Gamma random number distribution. |
|
|
Generates random numbers according to the Laplace random number distribution. |
|
|
Generate a tensor from a multinomial distribution. |
|
|
Generate a tensor from a multinomial distribution. |
|
|
Return a new tensor that fills numbers from the uniform distribution over an interval \([0, 1)\) based on the given size and dtype. |
|
|
Return a tensor with the same shape as input that is filled with random numbers from a uniform distribution on the interval \([0, 1)\). |
|
|
Return a tensor whose elements are random integers in the range of [ low , high ) . |
|
|
Returns a tensor with the same shape as input whose elements are random integers in the range of [ low , high ) . |
|
|
Return a new tensor with given shape and dtype, filled with random numbers from the standard normal distribution. |
|
|
Return a tensor with the same shape as input, filled with random numbers from the standard normal distribution. |
|
|
Generate random numbers from the Gamma distribution(s). |
|
|
Generate random number Tensor with shape according to a Poisson distribution with mean rate. |
|
|
Generates random permutation of integers from 0 to n-1. |
|
|
Generates random numbers according to the Laplace random number distribution (mean=0, lambda=1). |
|
|
Generates random numbers according to the standard Normal (or Gaussian) random number distribution. |
|
|
Generates random numbers according to the Uniform random number distribution. |
|
Array Operation
API Name |
Description |
Supported Platforms |
Return a tensor of containing the positions of all non-zero elements in the input tensor. |
|
|
Divides batch dimension with blocks and interleaves these blocks back into spatial dimensions. |
|
|
Count the frequency of each value in the input tensor of non-negative ints. |
|
|
Creates a block diagonal matrix from the provided tensor. |
|
|
Broadcasts input tensor to a given shape. |
|
|
Connect input tensors along with the given axis. |
|
|
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 retaining the original tensor shape in the final output. |
|
|
Split the input tensor into multiple sub-tensors along the specified axis. |
|
|
Creates a new tensor by horizontally stacking the tensors in tensors. |
|
|
Alias for |
||
Returns a tensor of complex numbers that are the complex conjugate of each element in input. |
|
|
Counts the number of non-zero values in the input tensor along the given axis. |
|
|
Return a deepcopy of input tensor. |
|
|
Return a tensor with the input as its diagonal elements and |
|
|
If input is a vector (1-D tensor), then returns a 2-D square tensor with the elements of input as the diagonal, If input is a tensor with more than one dimension, then returns a 2-D tensor with diagonal elements equal to a flattened input. |
|
|
Returns diagonals of the input tensor along specified dimension. |
|
|
Embeds the values of the src tensor into input along the diagonal elements of input, with respect to dim1 and dim2 . |
|
|
Create a tensor whose diagonals of certain 2D planes (specified by dim1 and dim2) are filled by input, and all other positions are set to |
|
|
Returns the shape of the input tensor. |
|
|
Splits a tensor along the 3rd axis. |
|
|
Stacks tensors along the third axis. |
|
|
According to the Einstein summation Convention (Einsum), the product of the input tensor elements is summed along the specified dimension. |
|
|
Adds an additional axis to input tensor. |
|
|
Reverses elements in a tensor along the given dims. |
|
|
Flip the input tensor in left/right direction. |
|
|
Flip the input tensor in up/down direction. |
|
|
Returns the slice of the input tensor corresponding to the elements of input_indices on the specified axis. |
|
|
Gathers elements along an axis specified by dim. |
|
|
Gathers elements along the specified dim and indices. |
|
|
Gathers slices from the input tensor by specified indices. |
|
|
Stacks tensors in sequence horizontally. |
|
|
Splits a tensor into multiple sub-tensors horizontally. |
|
|
Add the elements of input y into input x along the given axis and indices. |
|
|
Fills the elements of the input x with value along the given axis and indices. |
|
|
Select the input tensor according to the specified axis and index and return a new tensor. |
|
|
Add x to v according to the indices. |
|
|
Add updates to var according to the indices and axis. |
|
|
Subtract v in x according to the indices. |
|
|
Updates x to v according to the indices. |
|
|
Determine whether the input Tensor contains |
|
|
Fills elements of tensor with value where mask is |
|
|
Return a new 1-D tensor which indexes the input tensor according to the boolean mask. |
|
|
Creates grids of coordinates specified by the 1D inputs。 |
|
|
Slice the tensor from the start position with a length of length along axis . |
|
|
Move axis of an array from source to destination. |
|
|
Swap two dimensions of the input tensor. |
|
|
Replace the NaN, positive infinity and negative infinity values in input with the specified values in nan, posinf and neginf respectively. |
|
|
Computes the mean of input in specified dimension, ignoring NaN. |
|
|
Computes the median and indices of input in specified dimension, ignoring NaN. |
|
|
Computes sum of input over a given dimension, ignoring NaN. |
|
|
Return a random tensor that conforms to the normal (Gaussian) distribution. |
|
|
Return the positions of all non-zero values. |
|
|
Return the total number of elements in the tensor. |
|
|
Permute the input tensor along the specified axis. |
|
|
Calculate the number of 1 bits in the binary representation of each element in the input tensor. |
|
|
Return the rank of a tensor. |
|
|
Repeat elements of a tensor along an axis, like |
|
|
Repeat elements of a tensor along an axis, like |
|
|
Reshape the input tensor based on the given shape. |
|
|
Partially reverse the input sequence. |
|
|
Roll the elements of a tensor along a dimension. |
|
|
Alias for |
|
|
Update the value in src to input according to the specified index. |
|
|
Scatters a tensor into a new tensor depending on the specified indices. |
|
|
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. |
|
|
On the specified dimension axis of input , src is scattered into input on the specified index of input . |
|
|
Returns a mask tensor representing the first N positions of each cell. |
|
|
Return the shape of the input tensor. |
|
|
Randomly shuffle a tensor along its first dimension. |
|
|
Count the total number of elements in input_x . |
|
|
Slice a tensor in the specified shape. |
|
|
Embed src into the sliced input along the specified axis . |
|
|
Sort the elements of the input tensor along the given axis. |
|
|
Divides a tensor's spatial dimensions into blocks and combines the block sizes with the original batch. |
|
|
Computes the mean of sparse segments in the input tensor. |
|
|
Split the tensor into chunks along the given axis. |
|
|
Remove length one axes from input tensor. |
|
|
Stack input tensors in specified axis. |
|
|
Extracts a strided slice of a Tensor based on begin/end index and strides. |
|
|
Calculate sum of tensor elements over a given dim. |
|
|
Interchange two axes of a tensor. |
|
|
Interchange two dims of a tensor. |
|
|
Return a new tensor by adding the values from updates in input_x indicated by indices . |
|
|
Return a new tensor which input_x is divided by the values from updates indicated by indices . |
|
|
Return a new tensor by performing a maximum update on input_x at the specified indices with the given update values. |
|
|
Return a new tensor by performing a minimum update on input_x at the specified indices with the given update values. |
|
|
Return a new tensor by performing a multiplication update on input_x at the specified indices with the given update values. |
|
|
Return a new tensor by performing a subtraction update on input_x at the specified indices with the given update values. |
|
|
Return a new tensor by performing a specified operation update on input_x at the specified indices with the given update values. |
|
|
Split the input tensor into multiple subtensors according to the specified indices or chunks. |
|
|
Creates a new tensor by repeating the elements in the input tensor dims times. |
|
|
Zero the input tensor above the diagonal specified. |
|
|
Zero the input tensor below the diagonal specified. |
|
|
Transpose dimensions of the input tensor according to input permutation. |
|
|
Remove a tensor dimension, return a tuple of all slices along a given dimension. |
|
|
Remove duplicate elements from the input tensor. |
|
|
Remove consecutive duplicate elements in the input tensor, retaining only the first occurrence from each repeated group. |
|
|
Compute the maximum of the input tensor along segments. |
|
|
Compute the minimum of the input tensor along segments. |
|
|
Compute the product of the input tensor along segments. |
|
|
Compute the sum of the input tensor along segments. |
|
|
Adds an additional dimension to the input tensor at the given dimension. |
|
|
Unstack the input tensor along the specified axis. |
|
|
Return a real tensor with the last dimension of size 2, composed of the real and imaginary parts of the complex elements in the input tensor. |
|
|
Split the input tensor with two or more dimensions, into multiple sub-tensors vertically according to indices_or_sections. |
|
|
Stacks tensors in sequence vertically. |
|
|
Return a tensor in which the elements are selected from input or other based on the condition. |
|
|
Compute the cross product of two input tensors along the specified dimension. |
|
|
Returns a tensor where each subtensor along the specified dimension is renormalized such that its p norm is less than or equal to maxnorm. |
|
Type Cast
API Name |
Description |
Supported Platforms |
Returns a tensor with the new specified data type. |
|
|
Check whether the input object is |
|
|
Converts a scalar to a tensor with the specified dtype. |
|
|
Converts a tuple to a tensor. |
|
Gradient Clipping
API Name |
Description |
Supported Platforms |
Clips tensor values by the ratio of the sum of their norms. |
|
|
Clips tensor values to a specified min and max. |
|
|
The input Tensor is cropped based on norm. |
|
Mathematical Functions
Element-wise Operations
API Name |
Description |
Supported Platforms |
Compute the absolute value of a tensor element-wise. |
|
|
Alias for |
|
|
Return the element-wise sum of all input tensors. |
|
|
Compute arccosine of each element in input tensors. |
|
|
Alias for |
|
|
Computes inverse hyperbolic cosine of each element in inputs tensors. |
|
|
Compute the element-wise sum of the two input tensors. |
|
|
Divide tensor1 by tensor2 element-wise, multiply the result by the scalar value , and add it to input . |
|
|
Multiply tensor1 by tensor2 element-wise, scale the result by the scalar value , and add it to input . |
|
|
Multiply the matrix mat and vector vec , and then add the result to the input . |
|
|
Return the element-wise sum of all input tensors. |
|
|
Returns the element-wise angle of the given complex tensor. |
Ascend`` |
|
Alias for |
|
|
Alias for |
|
|
Alias for |
|
|
Alias for |
|
|
Alias for |
|
|
Alias for |
|
|
Computes arcsine of input tensors element-wise. |
|
|
Computes inverse hyperbolic sine of the input element-wise. |
|
|
Computes the trigonometric inverse tangent of the input element-wise. |
|
|
Returns arctangent of input/other element-wise. |
|
|
Computes inverse hyperbolic tangent of the input element-wise. |
|
|
Returns a one-dimensional tensor of each zero-dimensional tensor, while tensors with one or more dimensions remain unchanged. |
|
|
Returns a 2-dimensional tensor of each tensor, while tensors with two or more dimensions remain unchanged. |
|
|
Returns a 3-dimensional tensor of each tensor, while tensors with three or more dimensions remain unchanged. |
|
|
Computes the zeroth order modified Bessel function of the first kind for each element input. |
|
|
Computes the exponentially scaled zeroth order modified Bessel function of the first kind for each element input. |
|
|
Computes the first order modified Bessel function of the first kind for each element input. |
|
|
Computes the exponentially scaled first order modified Bessel function of the first kind for each element input. |
|
|
Computes the zeroth order Bessel function of the first kind for each element input. |
|
|
Computes the first order Bessel function of the first kind for each element input. |
|
|
Computes the zeroth order modified Bessel function of the second kind for each element input. |
|
|
Computes the exponentially scaled zeroth order modified Bessel function of the second kind for each element input. |
|
|
Computes the first order modified Bessel function of the second kind for each element input. |
|
|
Computes the exponentially scaled first order modified Bessel function of the second kind for each element input. |
|
|
Computes the zeroth order Bessel function of the second kind for each element input. |
|
|
Computes the first order Bessel function of the second kind for each element input. |
|
|
Compute the bitwise AND of two input tensors. |
|
|
Perform a left bitwise shift operation on the input element-wise, where the number of bits to shift is specified by other. |
|
|
Compute the bitwise OR of two input tensors. |
|
|
Perform a right bitwise shift operation on the input element-wise, where the number of bits to shift is specified by other. |
|
|
Compute the bitwise XOR of two input tensors. |
|
|
Rounds a tensor up to the closest integer element-wise. |
|
|
Clamp all elements of the input tensor within the range [min, max]. |
|
|
Alias for |
|
|
Return all r-length subsequences of input tensor. |
|
|
Create a float tensor composed of the absolute values of x and the signs of other . |
|
|
Computes cosine of input element-wise. |
|
|
Computes hyperbolic cosine of input element-wise. |
|
|
Calculate cosine similarity between two input tensors along the specified dimension. |
|
|
Return the covariance matrix of the input tensor, where the rows of the input tensor represent variables and the columns represent observations. |
|
|
Computes the n-th forward difference along the given axis. |
|
|
Convert angles from degrees to radians element-wise. |
|
|
Computes the logarithmic derivative of the gamma function on input tensor. |
|
|
Divide the first input tensor by the second input tensor in floating-point type element-wise. |
|
|
Alias for |
|
|
Compute the Gauss error of input tensor element-wise. |
|
|
Compute the complementary error function of input tensor element-wise. |
|
|
Compute the inverse error of input tensor element-wise. |
|
|
Compute exponential of the input tensor element-wise. |
|
|
Compute base two exponential of the input tensor element-wise. |
|
|
Compute exponential of the input tensor, then minus 1, element-wise. |
Ascend`` |
|
Rounds a tensor down to the closest integer element-wise. |
|
|
Alias for |
|
|
Compute element-wise division of input by other and floor the result. |
|
|
Compute the remainder of element-wise flooring division of first input by second input. |
|
|
Computes the first input to the power of the second input. |
|
|
Compute the maximum of input tensors element-wise. |
|
|
Compute the remainder of element-wise division of first input by the second input. |
|
|
Return the fractional part of each element in the input tensor. |
|
|
Computes greatest common divisor of input tensors element-wise. |
|
|
Given the legs of a right triangle, return its hypotenuse, element-wise. |
|
|
Calculates lower regularized incomplete Gamma function. |
|
|
Calculates upper regularized incomplete Gamma function. |
|
|
Return a new tensor containing imaginary value of the input tensor, element-wise. |
|
|
For details, please refer to |
|
|
Computes Reciprocal of input tensor element-wise. |
|
|
Flip all bits of input tensor element-wise. |
|
|
Computes least common multiplier of input tensors element-wise. |
|
|
Multiplies input tensor by \(2^{other}\) element-wise. |
|
|
Does a linear interpolation of two tensors input and end based on a float or tensor weight. |
|
|
Compute the natural logarithm of the input tensor element-wise. |
|
|
Compute the logarithm to the base 2 of the input tensor element-wise. |
|
|
Compute the logarithm to the base 10 of the input tensor element-wise. |
|
|
Compute the natural logarithm of (tensor + 1) element-wise. |
|
|
Computes the logarithm of the sum of exponentiations of the inputs. |
|
|
Computes the logarithm of the sum of exponentiations in base of 2 of the inputs. |
|
|
Compute the "logical AND" of two tensors element-wise. |
|
|
Compute the "logical NOT" of the input tensor element-wise. |
|
|
Compute the "logical OR" of two tensors element-wise. |
|
|
Compute the "logical XOR" of two tensors element-wise. |
|
|
Calculate the logit of a tensor element-wise. |
|
|
Multiplies two tensors element-wise. |
|
|
Alias for |
|
|
Compute the multivariate log-gamma function with dimension p element-wise. |
|
|
Returns a tensor with negative values of the input tensor element-wise. |
|
|
Alias for |
|
|
Returns the next representable floating-point value after input towards other element-wise. |
|
|
Converts polar coordinates to Cartesian coordinates. |
|
|
Computes the \(n\)-th derivative of the polygamma function on input. |
|
|
Return self tensor. |
|
|
Calculate the exponent power of each element in input. |
|
|
Converts angles in radians to angles in degrees element-wise. |
|
|
Expand the multidimensional Tensor into 1D along the 0 axis direction. |
|
|
Return a tensor that is the real part of the input. |
|
|
Returns reciprocal of a tensor element-wise. |
|
|
Compute the remainder of division for the input tensor element-wise. |
|
|
Rotate a n-D tensor by 90 degrees in the plane specified by dims axis. |
|
|
Round elements of input to the nearest integer. |
|
|
Compute reciprocal of square root of input tensor element-wise. |
|
|
Extension of |
|
|
Return an element-wise indication of the sign of a number. |
|
|
Determine the symbol of each element. |
|
|
Compute sine of the input tensor element-wise. |
|
|
Compute the normalized sinc of input. |
|
|
Compute hyperbolic sine of the input element-wise. |
|
|
Return sqrt of a tensor element-wise. |
|
|
Return square of a tensor element-wise. |
|
|
Subtract the second input from the first input element-wise. |
|
|
Subtract other scaled by alpha from input. |
|
|
Transpose a 2-D tensor. |
|
|
Computes tangent of input element-wise. |
|
|
Apply the element-wise Tanhshrink function. |
|
|
Compute the trapezoidal rule along dim. |
|
|
Return a 2-by-N tensor containing the indices of the lower triangular elements of a row * col matrix. |
|
|
Return a 2-by-N tensor containing the indices of the upper triangular elements of a row * col matrix. |
|
|
Alias for |
|
|
Returns a tensor with the truncated integer values of the elements of the input tensor. |
|
|
Divide the first input tensor x by the second input tensor y element-wise and rounds the results of division towards zero. |
|
|
Return the remainder of division element-wise. |
|
|
Divide x by y element-wise. |
|
|
Compute input multiplied by the logarithm of other element-wise. |
|
|
Elemental-wise compute the Hurwitz zeta function values. |
|
Reduction Functions
API Name |
Description |
Supported Platforms |
Tests if all element in input evaluates to True along the given axes. |
|
|
Return the maximum values along the given axis of the tensor. |
|
|
Return the minimum values along the given axis of the tensor. |
|
|
Return the minimum values and maximum values along the given axes of the tensor. |
|
|
Tests if any element in input evaluates to True along the given axes. |
|
|
Return the indices of the maximum values along a specified dimension of the tensor. |
|
|
Return the indices of the minimum values along a specified dimension of the tensor. |
|
|
Return the cumulative maximum values and their indices along the given axis of the tensor. |
|
|
Return the cumulative minimum values and their indices along the given axis of the tensor. |
|
|
Return the cumulative product along the given dimension of the tensor. |
|
|
Return the cumulative sum along the given axis of the tensor. |
|
|
Computes the histogram of a tensor. |
|
|
Calculate the log of cumulative summed exponentials of the tensor along a specified dimension. |
|
|
Calculate the log of summed exponentials of the tensor along a specified dimension. |
|
|
Return the maximum values and their indices along the given axis of the tensor. |
|
|
Compute the mean(s) of the tensor along the specified axis(axes). |
|
|
Return the median(s) and indice(s) of the tensor along the specified axis. |
|
|
Return the minimum values and their indices along the given axis of the tensor. |
|
|
Compute the matrix norm or vector norm of the tensor along a specified dimension. |
|
|
Return the product(s) of the tensor along the specified axis(axes). |
|
|
Compute the standard deviation of the tensor along a specified axis. |
|
|
Compute the standard deviation and the mean of the tensor along a specified axis. |
|
|
Compute the variance of the tensor along a specified axis. |
|
|
Compute the variance and the mean of the tensor along a specified axis. |
|
Comparison Functions
API Name |
Description |
Supported Platforms |
Return the indices that sort the tensor along the specified axis. |
|
|
Return a boolean tensor where two tensors are element-wise equal within a tolerance. |
|
|
Return the indices of the buckets to which each element in the input tensor belongs. |
|
|
Compute the equivalence of the two inputs element-wise. |
|
|
Compute the equivalence of the two inputs element-wise. |
|
|
Compute the value of \(input >= other\) element-wise. |
|
|
Compute the value of \(input > other\) element-wise. |
|
|
Compute the value of \(input >= other\) element-wise. |
|
|
Compute the value of \(input > other\) element-wise. |
|
|
Return whether the elements in second input tensor exist among the top k elements of the first input tensor. |
|
|
Return a boolean tensor where two tensors are element-wise equal within a tolerance. |
|
|
Return a boolean tensor indicating which elements are finite. |
|
|
Return a boolean tensor indicating which elements are +/- inifnity. |
|
|
Return a boolean tensor indicating which elements are NaN. |
|
|
Return a boolean tensor indicating which elements are negative infinity. |
|
|
Return a boolean tensor indicating which elements are positive infinity. |
|
|
Return a boolean tensor indicating which elements are real. |
|
|
Return a boolean tensor indicating which elements are complex. |
|
|
If the data type of the tensor is a floating point data type, return True. |
|
|
Compute the value of \(input <= other\) element-wise. |
|
|
Compute the value of \(input < other\) element-wise. |
|
|
Compute the value of \(input <= other\) element-wise. |
|
|
Alias for |
|
|
Compute the maximum of the two input tensors element-wise. |
|
|
Compute the minimum of the two input tensors element-wise. |
|
|
Return a tensor obtained by sorting the input tensor in ascending order along its first dimension. |
|
|
Compute the non-equivalence of two inputs element-wise. |
|
|
Alias for |
|
|
Return the position indices where the elements can be inserted into the input tensor to maintain the increasing order of the input tensor. |
|
|
Return the top k largest or smallest elements of the input tensor along a specified dimension. |
|
Linear Algebraic Functions
API Name |
Description |
Supported Platforms |
Apply batch matrix multiplication to batch1 and batch2, with a reduced add step and add input to the result. |
|
|
Multiply matrix mat1 and matrix mat2. |
|
|
Compute the outer product of two vector vec1 and vec2, and add the resulting matrix to x. |
|
|
Calculate the conjugation of tensor element-wise, and transpose the last two dimensions. |
|
|
Perform a batch matrix-matrix product of matrices in batch1 and batch2 , input is added to the final result. |
|
|
Computation of batch dot product between samples in two tensors containing batch dims. |
|
|
Perform a batch matrix-matrix product of matrices in input tensors. |
|
|
Return the Cholesky decomposition of zero or more batch dimensions consisting of symmetric positive-definite matrices. |
|
|
Computes the solution of a set of linear equations with a positive definite matrix, according to its Cholesky decomposition factor input2 . |
|
|
Return the matrix norm or vector norm of a given tensor. |
|
|
Computation a dot product of two input tensors. |
|
|
Compute the eigenvalues of a square matrix. |
|
|
Perform a QR decomposition on the input tensor \(A = QR\). |
|
|
Calculate the outer product of two arrays input and vec2. |
|
|
Return the dot product of two 1-D tensors. |
|
|
Compute the inverse of the input matrix. |
|
|
Compute the Kronecker product of two tensors. |
|
|
Calculate log determinant of one or a batch of square matrices. |
|
|
Compute the solution to a system of linear equations \(Ay = b\). |
|
|
Unpack the LU decomposition returned by |
|
|
Return the matrix product of two tensors. |
|
|
Copy a tensor setting everything outside a central band in each innermost matrix to zero. |
|
|
Solves systems of linear equations. |
|
|
Return a tensor with the contents in x as k[0]-th to k[1]-th diagonals of a matrix, with everything else padded with padding_value . |
|
|
Return a tensor that retains the values of the specified diagonal while setting all other elements to zero. |
|
|
Return a tensor by replacing the elements on the k[0]-th to k[1]-th diagonals of the matrix x with the values from the input diagonal . |
|
|
Returns the matrix product of two arrays. |
|
|
Multiplies matrix mat and vector vec. |
|
|
Compute outer product of two tensors. |
|
|
Compute the first \(N\) columns of a product of Householder matrices. |
|
|
Calculates the product of a matrix other and a matrix Q (represented by Householder vectors input and Householder reflection coefficients tau). |
|
|
Computes the (Moore-Penrose) pseudo-inverse of a matrix. |
|
|
Computes the singular value decompositions of one or more matrices. |
|
|
Computes the sign and the log of the absolute value of the determinant of one or more square matrices. |
|
|
Return the sum of the elements along the diagonal of the input tensor. |
|
|
Compute the tensor dot product along the specified axes. |
|
|
Generates a Vandermonde matrix. |
|
|
Calculates the dot product of two batches of vectors along the specified dimension. |
|
Spectral Functions
API Name |
Description |
Supported Platforms |
Bartlett window function. |
|
|
Blackman window function. |
|
|
Hamming window function. |
|
|
Hann window function. |
|
|
Kaiser window function. |
|
Neural Network Layer Functions
Neural Network
API Name |
Description |
Supported Platforms |
Applies a 1D adaptive average pooling over an input Tensor which can be regarded as a composition of 1D input planes. |
|
|
Performs 2D adaptive average pooling on a multi-plane input signal. |
|
|
Performs 3D adaptive average pooling on a multi-plane input signal. |
|
|
Applies a 1D adaptive maximum pooling over an input Tensor which can be regarded as a composition of 1D input planes. |
|
|
This operator applies a 2D adaptive max pooling to an input signal composed of multiple input planes. |
|
|
Applies a 1D average pooling over an input Tensor which can be regarded as a composition of 1D input planes. |
|
|
Applies a 2D average pooling over an input Tensor which can be regarded as a composition of 2D input planes. |
|
|
Applies a 3D average pooling over an input Tensor which can be regarded as a composition of 3D input planes. |
|
|
Batch Normalization for input data and updated parameters. |
|
|
Returns the sum of the input_x and the bias Tensor. |
|
|
Applies bilinear dense connected layer for input1 and input2. |
|
|
Performs greedy decoding on the logits given in inputs. |
|
|
Applies a 1D convolution over an input tensor. |
|
|
Applies a 2D convolution over an input tensor. |
|
|
Applies a 3D convolution over an input tensor. |
|
|
Given 4D tensor inputs x, weight and offsets, compute a 2D deformable convolution. |
|
|
Applies the dense connected operation to the input. |
|
|
During training, randomly zeroes some of the elements of the input tensor with probability p from a Bernoulli distribution. |
|
|
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\)). |
|
|
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\)). |
|
|
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\)). |
|
|
Retrieve the word embeddings in weight using indices specified in input. |
|
|
Flatten a tensor along dimensions from start_dim to start_dim. |
|
|
Combines an array of sliding local blocks into a large containing tensor. |
|
|
Applies the 3D FractionalMaxPool operation over input. |
|
|
This is a FlashAttention function designed for both incremental and full inference scenarios. |
|
|
The interface is used for self-attention fusion computing. |
|
|
Group Normalization over a mini-batch of inputs. |
|
|
Applies the Layer Normalization on the mini-batch input. |
|
|
Applying 1D LPPooling operation on an input Tensor can be regarded as forming a 1D input plane. |
|
|
Applying 2D LPPooling operation on an input Tensor can be regarded as forming a 2D input plane. |
|
|
Local Response Normalization. |
|
|
Performs a 2D max pooling on the input Tensor. |
|
|
Performs a 3D max pooling on the input Tensor. |
|
|
Computes the inverse of max_pool1d. |
|
|
Computes the inverse of max_pool2d. |
|
|
Computes the inverse of |
|
|
Permute the tokens based on the indices. |
|
|
Unpermute a tensor of permuted tokens based on sorted indices, and optionally merge the tokens with their corresponding probabilities. |
|
|
The interface for incremental inference. |
|
|
The interface for fully inference. |
|
|
Implement self-attention calculations in training scenarios. |
|
|
The RmsNorm(Root Mean Square Layer Normalization) operator is a normalization operation. |
|
|
Extracts sliding local blocks from a batched input tensor. |
|
Loss Functions
API Name |
Description |
Supported Platforms |
Computes the binary cross entropy(Measure the difference information between two probability distributions) between predictive value logits and target value labels. |
|
|
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. |
|
|
CosineEmbeddingLoss creates a criterion to measure the similarity between two tensors using cosine distance. |
|
|
The cross entropy loss between input and target. |
|
|
Calculates the CTC (Connectionist Temporal Classification) loss and the gradient. |
|
|
Gaussian negative log likelihood loss. |
|
|
Measures Hinge Embedding Loss given an input Tensor intputs and a labels Tensor targets (containing 1 or -1). |
|
|
Calculates the error between the predicted value and the target value, which has the best of both the loss of |
|
|
Computes the Kullback-Leibler divergence between the logits and the labels. |
|
|
Calculate the mean absolute error between the input value and the target value. |
|
|
MarginRankingLoss creates a criterion that measures the loss. |
|
|
Calculates the mean squared error between the predicted value and the label value. |
|
|
Hinge loss for optimizing a multi-class classification. |
|
|
Hinge loss for optimizing a multi-label classification. |
|
|
Calculates the MultiLabelSoftMarginLoss. |
|
|
Gets the negative log likelihood loss between inputs and target. |
|
|
Computes smooth L1 loss, a robust L1 loss. |
|
|
Calculate the soft margin loss of input and target. |
|
|
TripletMarginLoss operation. |
|
Activation Functions
API Name |
Description |
Supported Platforms |
celu activation function, computes celu (Continuously differentiable exponential linear units) of input tensors element-wise. |
|
|
Exponential Linear Unit activation function. |
|
|
Fast Gaussian Error Linear Units activation function. |
|
|
Gaussian Error Linear Units activation function. |
|
|
Computes GLU (Gated Linear Unit activation function) of input tensors. |
|
|
Returns the samples from the Gumbel-Softmax distribution and optionally discretizes. |
|
|
Hard Shrink activation function. |
|
|
Hard Sigmoid activation function. |
|
|
Hard Swish activation function. |
|
|
Applies the hardtanh activation function element-wise. |
|
|
leaky_relu activation function. |
|
|
Applies the Log Softmax function to the input tensor on the specified axis. |
|
|
Applies LogSigmoid activation element-wise. |
|
|
Computes MISH(A Self Regularized Non-Monotonic Neural Activation Function) of input tensors element-wise. |
|
|
Parametric Rectified Linear Unit activation function. |
|
|
Computes ReLU (Rectified Linear Unit activation function) of input tensors element-wise. |
|
|
Computes ReLU (Rectified Linear Unit) upper bounded by 6 of input tensors element-wise. |
|
|
Randomized Leaky ReLU activation function. |
|
|
Activation function SeLU (Scaled exponential Linear Unit). |
|
|
Computes Sigmoid of input element-wise. |
|
|
Computes Sigmoid Linear Unit of input element-wise, also known as Swish function. |
|
|
Applies the Softmax operation to the input tensor on the specified axis. |
|
|
Applies the Softmin operation to the input tensor on the specified axis. |
|
|
Soft Shrink activation function. |
|
|
SoftSign activation function. |
|
|
Computes SwiGLU (Swish-Gated Linear Unit activation function) of input tensor. |
|
|
Computes hyperbolic tangent of input element-wise. |
|
|
Returns each element of input after thresholding by thr as a Tensor. |
|
Distance Functions
API Name |
Description |
Supported Platforms |
Computes p-norm distance between each pair of row vectors of two input Tensors. |
|
|
Computes batched the \(p\)-norm distance between each pair of the two collections of row vectors. |
|
|
Calculates the distance between every pair of row vectors in the input using the p-norm. |
|
Sampling Functions
API Name |
Description |
Supported Platforms |
Generates a random sample as index tensor with a mask tensor from a given tensor. |
|
|
Generates random samples from a given categorical distribution tensor. |
|
|
Generates random labels with a log-uniform distribution for sampled_candidates. |
|
|
Uniform candidate sampler. |
|
Image Functions
API Name |
Description |
Supported Platforms |
Returns a 2D or 3D flow field (sampling grid) based on theta, a batch of affine matrices. |
|
|
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. |
|
|
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. |
|
|
Combines an array of sliding local blocks into a large containing tensor. |
|
|
Checks whether the bounding box is in the image. |
|
|
Extracts crops from the input image Tensor and resizes them. |
|
|
Given an input and a flow-field grid, computes the output using input values and pixel locations from grid. |
|
|
Samples the input Tensor to the given size or scale_factor by using one of the interpolate algorithms. |
|
|
Calculates intersection over union for boxes. |
|
|
Pads the input tensor according to the padding. |
|
|
Extends the last dimension of the input tensor from 1 to pad_dim_size, by filling with 0. |
|
|
Applies the PixelShuffle operation over input input which implements sub-pixel convolutions with stride \(1/r\) . |
|
|
Applies the PixelUnshuffle operation over input input which is the inverse of PixelShuffle. |
|
|
Implements the Rotary Position Embedding algorithm. |
|
|
Calculate the overlap area between rotated rectangles. |
|
|
Alias for |
|
Parameter Operation Functions
API Name |
Description |
Supported Platforms |
Assigns a parameter or tensor with a value. |
|
|
Updates a parameter or tensor by adding a value to it. |
|
|
Updates a parameter or tensor by subtracting a value from it. |
|
|
Perform an addition update on input_x based on the specified indices and update values. |
|
|
Perform a division update on input_x based on the specified indices and update values. |
|
|
Perform a minimum update on input_x based on the specified indices and update values. |
|
|
Perform a maximum update on input_x based on the specified indices and update values. |
|
|
Perform a multiplication update on input_x based on the specified indices and update values. |
|
|
Perform a sparse addition update on input_x based on the specified indices and update values. |
|
|
Perform a sparse division update on input_x based on the specified indices and update values. |
|
|
Perform a sparse maximum update on input_x based on the specified indices and update values. |
|
|
Perform a sparse minimum update on input_x based on the specified indices and update values. |
|
|
Perform a sparse multiplication update on input_x based on the specified indices and update values. |
|
|
Perform a sparse subtraction update on input_x based on the specified indices and update values. |
|
|
Updates the input tensor values using the given input indices and update values. |
|
Differential Functions
API Name |
Description |
Supported Platforms |
This function is designed to calculate the higher order differentiation of given composite function. |
|
|
This function is designed to calculate the higher order differentiation of given composite function. |
|
|
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. |
|
Debugging Functions
API Name |
Description |
Supported Platforms |
Outputs the inputs to stdout. |
|
|
Save tensor in npy format. |
|
Sparse Functions
Warning
These are experimental APIs that are subject to change or deletion.
API Name |
Description |
Supported Platforms |
Convert a Tensor to COOTensor. |
|
|
Convert a Tensor to CSRTensor. |
|
|
Converts a CSRTensor to COOTensor. |
|
COO Functions
Warning
These are experimental APIs that are subject to change or deletion.
API Name |
Description |
Supported Platforms |
Returns coo_absolute value of a COOTensor element-wise. |
|
|
Computes arccosine of input coo_tensors element-wise. |
|
|
Computes inverse hyperbolic cosine of the inputs element-wise. |
|
|
Computes the sum of x1(COOTensor) and x2(COOTensor), and return a new COOTensor based on the computed result and thresh. |
|
|
Computes arcsine of input coo_tensors element-wise. |
|
|
Computes inverse hyperbolic sine of the input element-wise. |
|
|
Computes the trigonometric inverse tangent of the input element-wise. |
|
|
Computes inverse hyperbolic tangent of the input element-wise. |
|
|
Rounds a COOTensor up to the closest integer element-wise. |
|
|
concatenates the input SparseTensor(COO format) along the specified dimension. |
|
|
Computes cosine of input element-wise. |
|
|
Computes hyperbolic cosine of input element-wise. |
|
|
Returns the element-wise exponential of a COOTensor. |
|
|
Returns exponential then minus 1 of a COOTensor element-wise. |
|
|
Rounds a COOTensor down to the closest integer element-wise. |
|
|
Computes Reciprocal of input COOTensor element-wise. |
|
|
Determines which elements are finite for each position. |
|
|
Determines which elements are inf or -inf for each position. |
|
|
Determines which elements are NaN for each position. |
|
|
Returns the natural logarithm of a COOTensor element-wise. |
|
|
Returns the natural logarithm of one plus the input COOTensor element-wise. |
|
|
Returns a COOTensor with coo_negative values of the input COOTensor element-wise. |
|
|
Computes ReLU (Rectified Linear Unit activation function) of input coo_tensors element-wise. |
|
|
Computes ReLU (Rectified Linear Unit) upper bounded by 6 of input coo_tensors element-wise. |
|
|
Returns half to even of a COOTensor element-wise. |
|
|
Sigmoid activation function. |
|
|
Computes sine of the input element-wise. |
|
|
Computes hyperbolic sine of the input element-wise. |
|
|
Softsign activation function. |
|
|
Computes sqrt of a COOTensor element-wise. |
|
|
Returns square of a COOTensor element-wise. |
|
|
Computes tangent of x element-wise. |
|
|
Computes hyperbolic tangent of input element-wise. |
|
CSR Functions
Warning
These are experimental APIs that are subject to change or deletion.
API Name |
Description |
Supported Platforms |
Returns csr_absolute value of a CSRTensor element-wise. |
|
|
Computes arccosine of input csr_tensors element-wise. |
|
|
Computes inverse hyperbolic cosine of the inputs element-wise. |
|
|
Computes the linear combination of two input CSRTensors a and b. |
|
|
Computes arcsine of input csr_tensors element-wise. |
|
|
Computes inverse hyperbolic sine of the input element-wise. |
|
|
Computes the trigonometric inverse tangent of the input element-wise. |
|
|
Computes inverse hyperbolic tangent of the input element-wise. |
|
|
Rounds a CSRTensor up to the closest integer element-wise. |
|
|
Computes cosine of input element-wise. |
|
|
Computes hyperbolic cosine of input element-wise. |
|
|
Returns csr_exponential of a CSRTensor element-wise. |
|
|
Returns exponential then minus 1 of a CSRTensor element-wise. |
|
|
Rounds a CSRTensor down to the closest integer element-wise. |
|
|
Computes Reciprocal of input CSRTensor element-wise. |
|
|
Determines which elements are finite for each position. |
|
|
Determines which elements are inf or -inf for each position. |
|
|
Determines which elements are NaN for each position. |
|
|
Returns the natural logarithm of a CSRTensor element-wise. |
|
|
Returns the natural logarithm of one plus the input CSRTensor element-wise. |
|
|
Return the matrix multiplication result of the right-multiply matrix (dense or CSRTensor) of the CSRTensor. |
|
|
Returns a CSRTensor with csr_negative values of the input CSRTensor element-wise. |
|
|
Computes ReLU (Rectified Linear Unit activation function) of input csr_tensors element-wise. |
|
|
Computes ReLU (Rectified Linear Unit) upper bounded by 6 of input csr_tensors element-wise. |
|
|
Returns half to even of a CSRTensor element-wise. |
|
|
Sigmoid activation function. |
|
|
Computes sine of the input element-wise. |
|
|
Computes hyperbolic sine of the input element-wise. |
|
|
Calculates the softmax of a CSRTensorMatrix. |
|
|
Softsign activation function. |
|
|
Returns sqrt of a CSRTensor element-wise. |
|
|
Returns square of a CSRTensor element-wise. |
|
|
Computes tangent of x element-wise. |
|
|
Computes hyperbolic tangent of input element-wise. |
|
MC2 Functions
Warning
These are experimental APIs that are subject to change or deletion.
API Name |
Description |
Supported Platforms |
In the TP segmentation scenario, allgather and matmul are fused, and communication and computational pipelines are parallelized within the fusion operator. |
|
|
In the TP segmentation scenario, matmul and reducescatter are fused, and communication and computational pipelines are parallelized within the fusion operator. |
|