Operator APIs (aclnn)

Instructions

To facilitate operator calling, a set of C-based APIs (prefixed with aclnn) is provided, eliminating the need for IR (Intermediate Representation) definitions and enabling efficient model building and app development. This approach is referred to as "single-operator API call", abbreviated as aclnn call.

When calling an operator API, you need to reference the dependent header files and library files. Generally, header files are located in ${INSTALL_DIR}/include/aclnnop by default, and library files are located in ${INSTALL_DIR}/lib64 by default. The specific files are as follows:

  • Header files: ① Method 1 (recommended): Reference the operator repository master header file aclnn_ops_${ops_project}.h. ② Method 2: Reference the single-operator API header file aclnn_*.h.

  • Library file: Reference the library file libopapi_${ops_project}.so corresponding to the operator repository. Note that the original master library file libopapi.so for all operator repositories will be deprecated in the future. It is not recommended for use, nor is it supported for simultaneous use with individual operator repository files.

Here, ${INSTALL_DIR} indicates the CANN installation directory, and ${ops_project} indicates the operator repository name (such as math, nn, cv, transformer). Set it to the actual operator repository name.

API List

Determinism Overview:

  • Configuration: Due to factors such as different CANN or NPU models, it may not be possible to guarantee consistent results across multiple runs of the same operator. Under the same conditions (platform, device, version, and other randomness parameters), some operator APIs can enable deterministic algorithms through aclrtCtxSetSysParamOpt (see acl API (C)) to ensure consistent results across multiple runs.
  • Performance: Deterministic computation for the same operator is typically slower than non-deterministic computation, which may degrade the single-run performance of the model. However, in scenarios such as experimentation, debugging, and troubleshooting where consistent results across multiple runs are required to locate issues, deterministic computation can improve efficiency.
  • Threading: The deterministic state can be set only once per thread. If set multiple times, only the last valid setting takes effect. A valid setting means that after the deterministic state is set, an operator task dispatch is actually executed. If only the setting is performed without any operator dispatch, the deterministic variable is enabled but not dispatched to the operator, so the operator is not executed. Solution: Setting determinism multiple times within a single thread is not recommended at this time. This issue exists in both binary enabled and disabled scenarios and will be resolved in a future version.
  • Symbol Description: A " - " symbol in the table indicates that the API does not currently support the product listed in that column.

The operator API list is as follows:

Interface NameDescriptionDeterministic Implementation (A2/A3)Deterministic Implementation (Ascend 950)
aclnnAbsComputes the absolute value of a tensor.DefaultDefault
aclnnAcos&aclnnInplaceAcosPerforms the arccosine operation on each element of the input matrix and outputs the result.Default-
aclnnAcosh&aclnnInplaceAcoshPerforms the inverse hyperbolic cosine operation on each element of the input tensor and outputs the result.Default-
aclnnAngleV2Computes the angle (in radians) for each element of the input tensor.Default-
aclnnAdd&aclnnInplaceAddPerforms addition.DefaultDefault
aclnnAddcdiv&aclnnInplaceAddcdivPerforms addition.DefaultDefault
aclnnAddcmul&aclnnInplaceAddcmulPerforms element-wise multiplication of tensor1 and tensor2, multiplies the result by the scalar value, and performs element-wise addition with the input self/selfRef.DefaultDefault
aclnnAddLoraAdds a LoRA (Low-Rank Adaptation) layer to a neural network, reducing the number of parameters through low-rank decomposition.Default-
aclnnAddr&aclnnInplaceAddrComputes the outer product of two 1D vectors vec1 and vec2 to obtain a 2D matrix, multiplies the outer product result by a coefficient, adds it to the self multiplied by a coefficient, and outputs the result.DefaultDefault
aclnnAddsPerforms addition.DefaultDefault
aclnnAddV3&aclnnInplaceAddV3Performs addition.DefaultDefault
aclnnAffineGridGenerates a 2D or 3D grid given a set of 3D affine parameter matrices (theta) and the output image size, where the grid represents the coordinates of points in the original image after affine transformation.Default-
aclnnAllFor each dimension in the given dimension dim, returns True if all elements corresponding to that dimension in the input tensor evaluate to True, otherwise returns False.DefaultDefault
aclnnAmaxReturns the maximum value of each slice of the tensor along the specified dimension (dim).DefaultDefault
aclnnAminReturns the minimum value of each slice of the tensor along the specified dimension (dim).DefaultDefault
aclnnAminmaxReturns the minimum and maximum values of each row of the input tensor along the specified dimension.DefaultDefault
aclnnAminmaxAllReturns the minimum and maximum values of the input tensor across all dimensions.DefaultDefault
aclnnAminmaxDimReturns the minimum and maximum values of the input tensor along the specified dimension.DefaultDefault
aclnnAnyFor each dimension in the given dimension dim, returns True if any element corresponding to that dimension in the input tensor evaluates to True, otherwise returns False.DefaultDefault
aclnnArangeObtains values from start to end at intervals of step and stores them in the output 1D tensor, where the data range is [start, end).DefaultDefault
aclnnArgMaxReturns the index of the maximum value of the tensor along the specified dimension (dim) and stores it in the out tensor.DefaultDefault
aclnnArgMinReturns the index of the minimum value of the tensor along the specified axis and stores it in out.DefaultDefault
aclnnArgsortSorts the elements of the input tensor in ascending or descending order along a specified dimension and returns the corresponding index values.DefaultDefault
aclnnAsin&aclnnInplaceAsinPerforms the arcsine operation on each element of the input matrix and outputs the result.Default-
aclnnAsinh&aclnnInplaceAsinhPerforms the inverse hyperbolic sine operation on each element of the input tensor and outputs the result.Default-
aclnnAtan&aclnnInplaceAtanPerforms the arctangent operation on each element of the input matrix and outputs the result.DefaultDefault
aclnnAtan2&aclnnInplaceAtan2Performs element-wise arctangent operation on the input tensors self and other.Default
aclnnAtanh&aclnnInplaceAtanhPerforms the inverse hyperbolic tangent operation on each element of the input tensor and outputs the result.Default-
aclnnBatchNormStatsComputes the mean and the reciprocal of the standard deviation of the single-device input data.DefaultDefault
aclnnBernoulli&aclnnInplaceBernoulliDraws binary random numbers (0 or 1) from a Bernoulli distribution, where prob is the probability of generating a binary random number and the input tensor specifies the shape.DefaultDefault
aclnnBernoulliTensor&aclnnInplaceBernoulliTensorDraws binary random numbers (0 or 1) from a Bernoulli distribution, where prob is the probability of generating a binary random number and the input tensor specifies the shape.DefaultDefault
aclnnBincountCounts the frequency of each number in a non-negative integer array.DefaultNon-deterministic by default; allowed to enable
aclnnBitwiseNotPerforms a logical NOT operation when the input is a BOOL tensor; performs a bitwise NOT operation when the input is an INT tensor.DefaultDefault
aclnnBitwiseAndScalarComputes the bitwise AND result of each element in the input tensor and the input scalar.DefaultDefault
aclnnBitwiseAndTensorPerforms a logical AND operation when the input is a BOOL tensor; performs a bitwise AND operation when the input is an INT tensor.DefaultDefault
aclnnBitwiseAndTensorOut&aclnnInplaceBitwiseAndTensorOutPerforms a logical AND operation when the input is a BOOL tensor; performs a bitwise AND operation when the input is an INT tensor.DefaultDefault
aclnnBitwiseOrScalar&aclnnInplaceBitwiseOrScalarComputes the bitwise OR of each element in the input tensor self and the input scalar other.DefaultDefault
aclnnBitwiseOrTensor&aclnnInplaceBitwiseOrTensorComputes the bitwise OR of each element in the tensor self and the element at the corresponding position in the other tensor.DefaultDefault
aclnnBitwiseXorScalar&aclnnInplaceBitwiseXorScalarComputes the bitwise XOR of each element in the input tensor self and the input scalar other. The inputs self and other must be of integer or boolean type. For boolean type, computes the logical XOR.DefaultDefault
aclnnBitwiseXorTensor&aclnnInplaceBitwiseXorTensorComputes the bitwise XOR of each element in the input tensor self and the element at the corresponding position in the input tensor other. The inputs self and other must be of integer or boolean type. For boolean type, computes the logical XOR.DefaultDefault
aclnnCalculateConvolutionWeightSizeCalculates the size of the weight to be allocated for the Convolution operator with NCHW format input. Only the Float16 data type is supported. This API is used only to determine how much size is needed for preprocessing the weight tensor to achieve optimal Convolution operator performance.Default-
aclnnCalculateMatmulWeightSizeCalculates the size of the weight to be allocated for the Matmul operator with ND format input. This API is used only to determine how much size is needed for preprocessing the weight tensor to achieve optimal Matmul operator performance.Default
aclnnCalculateMatmulWeightSizeV2Calculates the space (in number of elements) required to convert the weight from ND format to NZ format for the Matmul operator. This API is used only to determine how much size is needed for preprocessing the weight tensor to achieve optimal Matmul operator performance.DefaultDefault
aclnnCastConverts the data type of a tensor.DefaultDefault
aclnnCatConcatenates all tensors in tensors along the dimension dim.DefaultDefault
aclnnCdistComputes the p-norm distance between each pair of points in two sets of vectors.Default-
aclnnCdistBackwardPerforms the backward propagation of aclnnCdist.Default-
aclnnCeil&aclnnInplaceCeilReturns the result of rounding up each element in the input tensor.DefaultDefault
aclnnChannelShuffleDivides the channels of a (*, C, H, W) tensor into g groups, randomly shuffles the channels within each group, and then merges all channels for output, while keeping the shape of the final output tensor consistent with the input tensor.DefaultDefault
aclnnChunkCatSplits all tensors in tensors into numChunks chunks along the dimension dim, then concatenates them along the dimension after dim, and finally converts the result to the data type of out.Default-
aclnnCircularPad2dPads the last two dimensions of the input tensor using circular padding.DefaultDefault
aclnnCircularPad3dPads the last three dimensions of the input tensor using circular padding.DefaultDefault
aclnnCircularPad2dBackwardPerforms backward propagation of circular_pad2d. For the forward computation, see aclnnCircularPad2d.DefaultDefault
aclnnCircularPad3dBackwardPerforms backward propagation of aclnnCircularPad3d.DefaultDefault
aclnnClampClamps all elements of the input to the range [min, max]. If min is None, there is no lower bound. If max is None, there is no upper bound.DefaultDefault
aclnnClampMax&aclnnInplaceClampMaxClamps all elements of the input to the range [-inf, max].DefaultDefault
aclnnClampMaxTensor&aclnnInplaceClampMaxTensorClamps all elements of the input to the range [-inf, max].DefaultDefault
aclnnClampMinClamps all elements of the input to the range [min, inf].DefaultDefault
aclnnClampMinTensor&aclnnInplaceClampMinTensorClamps all elements of the input to the range [min, inf].DefaultDefault
aclnnCoalesceSparseAccumulates and sums the values at the same coordinate points to reduce the memory size of the Coo_Tensor.Non-deterministic by default; not allowed to enable-
aclnnClampTensorClamps all elements of the input to the range [min, max]. If min is omitted, there is no lower bound. If max is omitted, there is no upper bound.DefaultDefault
aclnnComplexTakes two tensors real and imag with the same shape and dtype as input.Default-
aclnnConfusionTransposeFuses reshape and transpose operations.DefaultDefault
aclnnConstantPadNdPads the input tensor self based on the pad parameter, with the padding value set to value.DefaultDefault
aclnnCos&aclnnInplaceCosPerforms the cosine operation on each element of the input matrix and outputs the result.DefaultDefault
aclnnCosh&aclnnInplaceCoshA hyperbolic function that returns a new tensor according to the formula. The shape of the result is the same as the input tensor.DefaultDefault
aclnnCummaxComputes the cumulative maximum of self and returns the maximum values along with the corresponding indices.Default-
aclnnCumminComputes the cumulative minimum of self and returns the minimum values along with the corresponding indices.Default
aclnnCumprod&aclnnInplaceCumprodAdds the aclnnCumprod API. The cumprod function computes the cumulative product of the input tensor along the specified dimension.Default-
aclnnCumsumPerforms cumulative summation on the elements of the input tensor self along the specified dimension dim and stores the result in the output tensor out.DefaultDefault
aclnnCumsumV2Performs cumulative summation on the elements of the input tensor self along the specified dimension dim and stores the result in the output tensor out.DefaultDefault
aclnnDiagIf the input is a vector (1D tensor), returns a 2D matrix tensor with the input elements on the diagonal. If the input is a 2D tensor, returns a 1D vector whose values are the diagonal elements of the input matrix specified by diagonal.DefaultDefault
aclnnDiagFlatGenerates a diagonal tensor. If the input self is a 1D tensor, returns a 2D tensor with the elements of self as the diagonal values. If the input self is a 2D or higher-dimensional tensor, it is first flattened (reduced to a 1D tensor) and then processed as in the first case.DefaultDefault
aclnnDigammaPerforms the digamma mathematical operation on each element of the input tensor.Default-
aclnnDiv&aclnnInplaceDivPerforms division.DefaultDefault
aclnnDivMod&aclnnInplaceDivModPerforms division and selects the rounding operation based on the mode parameter.DefaultDefault
aclnnDivMods&aclnnInplaceDivModsPerforms division and selects the rounding operation based on the mode parameter.DefaultDefault
aclnnDivs&aclnnInplaceDivsPerforms division.DefaultDefault
aclnnDotComputes the dot product of two 1D tensors.DefaultDefault
aclnnDropoutDuring training, randomly zeros elements of the input with probability p and scales the output by a factor of 1/(1-p).Default-
aclnnDropoutBackwardDuring training, zeros elements of the input based on the corresponding bit values in mask and scales or zeros them according to scale. If the corresponding bit in mask is 1, the corresponding element in gradOutput is scaled up. If the bit in mask is 0, the corresponding element in gradOutput is set to zero. Specifically, if scale is 0, all elements are set to 0. If scale is 1, the elements of gradOutput remain unchanged. It is recommended to use this API in combination with aclnnDropoutGenMask or aclnnDropoutGenMaskV2.DefaultDefault
aclnnDropoutDoMaskRandomly zeros elements of the input with probability prob and scales the output by a factor of 1/(1-prob).DefaultDefault
aclnnDropoutGenMaskDuring training, generates a mask with probability prob for zeroing elements.DefaultDefault
aclnnDropoutGenMaskV2During training, generates a mask with probability prob for zeroing elements.DefaultDefault
aclnnDropoutGenMaskV2TensorDuring training, generates a mask with probability prob for zeroing elements.DefaultDefault
aclnnDropoutV3Randomly zeros elements of the input with probability p and scales the output by a factor of 1/(1-p).DefaultDefault
aclnnEqScalar&aclnnInplaceEqScalarCompares whether the value of each element in self is equal to the value of other, and writes the comparison result of each element in self with the value of other into out.DefaultDefault
aclnnEqTensor&aclnnInplaceEqTensorCompares whether the elements in two tensors are equal and returns a tensor, where self == other yields True (1.) and otherwise yields False (0.).DefaultDefault
aclnnEqualChecks whether two tensors have the same size and elements and returns a Bool value.DefaultDefault
aclnnErf&aclnnInplaceErfReturns the value of the error function for each element in the input tensor.DefaultDefault
aclnnErfc&aclnnInplaceErfcReturns the value of the complementary error function for each element in the input tensor.Default-
aclnnExp&aclnnInplaceExpReturns a new tensor where each element is the exponential of the corresponding element in the input tensor.DefaultDefault
aclnnExpandBroadcasts the input tensor self to a tensor of the specified size.DefaultDefault
aclnnExpm1&aclnnInplaceExpm1Computes the power of the natural constant e with self as the exponent, and subtracts 1 from the exponential result.DefaultDefault
aclnnExp2&aclnnInplaceExp2Computes the power of base 2 for each element in self.DefaultDefault
aclnnExpSegsumPerforms segmented sum computation. Generates a semi-separable matrix with zeros on the diagonal and -inf in the upper triangle.Default-
aclnnExpSegsumBackwardPerforms the backward computation of aclnnExpSegsum.Default-
aclnnEyeReturns a 2D tensor with ones on the diagonal and zeros elsewhere.DefaultDefault
aclnnFlattenFlattens the input tensor into a 2D tensor based on the given axis.DefaultDefault
aclnnFloor&aclnnInplaceFloorRounds down each element in the input tensor and writes the result back into the input tensor.DefaultDefault
aclnnFloorDivide&aclnnInplaceFloorDividePerforms division and rounds the remainder down.DefaultDefault
aclnnFloorDivides&aclnnInplaceFloorDividesPerforms division and rounds the remainder down.DefaultDefault
aclnnFmodScalar&aclnnInplaceFmodScalarReturns the remainder of self divided by other.DefaultDefault
aclnnFmodTensor&aclnnInplaceFmodTensorReturns the remainder of self divided by other.DefaultDefault
aclnnFrac&aclnnInplaceFracComputes the fractional part of each element in the input tensor and outputs the result.Default
aclnnGcdComputes the element-wise greatest common divisor of the given self and other, where both self and other must be integers.DefaultDefault
aclnnGerComputes the outer product of self and vec2.DefaultDefault
aclnnGeScalar&aclnnInplaceGeScalarDetermines whether each element in the input tensor is greater than or equal to the other scalar value, and returns a Bool-type tensor indicating whether the greater-than-or-equal-to condition holds at each position of the input tensor.DefaultDefault
aclnnGeTensor&aclnnInplaceGeTensorDetermines whether each element in the input tensor is greater than or equal to the corresponding element in the other tensor, and returns a Bool-type tensor indicating whether the greater-than-or-equal-to condition holds at each position of the input tensor.DefaultDefault
aclnnGlobalAveragePoolApplies average pooling over the values in the same channel of an input tensor X.DefaultDefault
aclnnGlobalMaxPoolTakes the maximum value over the values in the same channel of an input tensor.DefaultDefault
aclnnGtScalar&aclnnInplaceGtScalarDetermines whether each element in the input tensor is greater than the other scalar value, and returns a Bool-type tensor indicating whether the greater-than condition holds at each position of the input tensor.DefaultDefault
aclnnGtTensor&aclnnInplaceGtTensorDetermines whether each element in the self tensor is greater than the corresponding element in the other tensor. Returns a tensor where True (1) indicates self > other, and False (0) otherwise.DefaultDefault
aclnnGroupedBiasAddGradPerforms backward propagation of the grouped bias addition (GroupedBiasAdd).DefaultDefault
aclnnGroupedBiasAddGradV2Performs the backward computation of groupBiasAdd. This API extends the functionality of the aclnnGroupedBiasAddGrad API by adding the groupIdxType attribute, which supports specifying the type of groupIdx.DefaultDefault
aclnnHansDecodeDecodes a compressed tensor based on PDF and reconstructs the tensor based on the mantissa.Default-
aclnnHansEncodePerforms PDF statistics on the byte where the exponent bits of the tensor reside, and performs lossless compression based on the PDF distribution statistics.Default-
aclnnHardtanh&aclnnInplaceHardtanhClamps all elements of the input to the range [clipValueMin, clipValueMax]. If an element is greater than clipValueMax, it is clamped to clipValueMax; if an element is less than clipValueMin, it is clamped to clipValueMin; otherwise, it remains unchanged.DefaultDefault
aclnnHistcUses min and max as the statistical bounds, divides the range between min and max into bins of equal width, and counts the number of elements of the tensor self that fall into each bin. If min and max are equal, the minimum and maximum values of all elements in the tensor are used as the statistical bounds. Elements less than min or greater than max are not counted.DefaultDefault
aclnnIm2colExtracts sliding local blocks from a batched input tensor and rearranges them into columns, concatenating them into a large tensor.DefaultDefault
aclnnInplaceAddsPerforms addition.DefaultDefault
aclnnInplaceBitwiseAndScalarComputes the bitwise AND of each element in the input tensor and the input scalar other. The input tensor and other must be of integer type or BOOL type. When the input is of BOOL type, computes the logical AND.DefaultDefault
aclnnInplaceBitwiseAndTensorPerforms a logical AND operation when the input is a BOOL-type tensor; performs a bitwise AND operation when the input is of INT type.DefaultDefault
aclnnInplaceCopyCopies the elements from src to the selfRef tensor and returns selfRef.DefaultDefault
aclnnInplaceFillDiagonalFills the diagonal of the tensor with fillValue.Default-
aclnnInplaceFillScalarFills the tensor with a specified scalar.DefaultDefault
aclnnInplaceFillTensorFills the selfRef tensor with value, where value is a tensor.DefaultDefault
aclnnInplaceMaskedFillScalarFills the elements in selfRef corresponding to the positions where the mask matrix is true with value.DefaultDefault
aclnnInplaceMaskedFillTensorFills the elements in selfRef corresponding to the positions where the mask matrix is true with value.DefaultDefault
aclnnInplaceNormalFills the tensor with elements drawn from a normal distribution parameterized by mean and std. Draws random numbers from a discrete normal distribution with the given mean and standard deviation std to fill the selfRef tensor. The mean is a base type float containing the mean of the normal distribution for each output element. std is a base type float containing the standard deviation of the normal distribution for each output element.DefaultDefault
aclnnInplaceNormalTensorFills the tensor with elements drawn from a normal distribution parameterized by mean and std.DefaultDefault
aclnnInplaceOneReturns a tensor of the same shape and type with all elements set to 1.DefaultDefault
aclnnInplaceRandomFills the selfRef tensor with numbers sampled from a discrete uniform distribution over [from, to-1].DefaultDefault
aclnnInplaceRandomTensorFills the selfRef tensor with numbers sampled from a discrete uniform distribution over [from, to-1].DefaultDefault
aclnnInplaceUniformGenerates random numbers from a discrete uniform distribution over the interval [from, to) and fills them into the selfRef tensor. (The BOOL type of this API is deprecated. If needed, use the aclnnBernoulli or aclnnInplaceBernoulli API instead.)DefaultDefault
aclnnInplaceUniformTensorGenerates random numbers from a discrete uniform distribution over the interval [from, to) and fills them into the selfRef tensor.DefaultDefault
aclnnInplaceZeroFills the selfRef tensor with all zeros.DefaultDefault
aclnnIsCloseReturns a new tensor with Boolean elements, indicating whether the given self and other are close to each other. Returns True if the values are close, and False otherwise.DefaultDefault
aclnnIsFiniteDetermines which elements in the tensor are finite values, i.e., not inf, -inf, or nan.DefaultDefault
aclnnIsInfDetermines which elements in the tensor are infinite values, i.e., inf or -inf.DefaultDefault
aclnnIsInScalarTensorChecks whether the elements in element are equal to testElement.DefaultDefault
aclnnIsInTensorScalarChecks whether the elements in element are equal to testElement.DefaultDefault
aclnnIsNegInfDetermines whether the elements of the input tensor are negative infinity.DefaultDefault
aclnnIsPosInfDetermines whether the elements of the input tensor are positive infinity.DefaultDefault
aclnnKlDivComputes the KL divergence.DefaultDefault
aclnnLeftShiftPerforms a bitwise left shift on each element in the input tensor self according to the corresponding parameter in the input tensor shiftBits.DefaultDefault
aclnnLeftShiftsPerforms a bitwise left shift on each element in the input tensor self according to the input scalar shiftBits.DefaultDefault
aclnnLerp&aclnnInplaceLerpPerforms linear interpolation between the start and end tensors based on the given weight, and returns the interpolated tensor.DefaultDefault
aclnnLerps&aclnnInplaceLerpsPerforms linear interpolation between the start and end tensors based on the given weight, and returns the interpolated tensor.DefaultDefault
aclnnLeScalar&aclnnInplaceLeScalarDetermines whether each element value in the input self is less than or equal to the value of other, and writes the comparison result of each element of self with other into out.DefaultDefault
aclnnLeTensor&aclnnInplaceLeTensorComputes whether each element value in self is less than or equal to the corresponding value in other, and writes the comparison result of each element of self with other into out.DefaultDefault
aclnnLgammaPerforms the lgamma mathematical operation on each element of the input tensor.Default-
aclnnLinspaceGenerates an evenly spaced sequence of values.DefaultDefault
aclnnLinalgCholeskyComputes the Cholesky decomposition of a real symmetric positive-definite matrix.Default-
aclnnLinalgCrossPerforms the linear_cross operation on the input tensor.DefaultDefault
aclnnLinalgQrPerforms orthogonal decomposition on the input tensor.Default-
aclnnLogSpaceCreates a one-dimensional tensor of size $\text{steps}$ whose values are evenly spaced on a logarithmic scale from $\text{base}^\text{start}$ to $\text{base}^\text{end}$, inclusive, with $\text{base}$ as the base.Default-
aclnnLog&aclnnInplaceLogComputes the natural logarithm.DefaultDefault
aclnnLog2&aclnnInplaceLog2Computes the base-2 logarithm.DefaultDefault
aclnnLog10&aclnnInplaceLog10Computes the base-10 logarithm of the input.DefaultDefault
aclnnLog1p&aclnnInplaceLog1pPerforms the log1p operation on the input tensor.DefaultDefault
aclnnLogAddExpComputes the logarithm (base e) of the sum of exponentials of the input tensors.Default-
aclnnLogAddExp2Computes the logarithm (base 2) of the sum of exponentials of the input tensors.Default-
aclnnLogdetComputes the natural logarithm of the determinant of the input self.DefaultDefault
aclnnLogicalAnd&aclnnInplaceLogicalAndPerforms the element-wise logical AND operation on the given input tensors. 0 is treated as False, and non-zero is treated as True.DefaultDefault
aclnnLogicalNot&aclnnInplaceLogicalNotComputes the element-wise logical NOT of the given input tensor. If the output type is not specified, the output tensor is of bool type.DefaultDefault
aclnnLogicalOr&aclnnInplaceLogicalOrPerforms the element-wise logical OR operation on the given input tensors. When both input tensors are of non-bool type, 0 is treated as False, and non-zero is treated as True.DefaultDefault
aclnnLogicalXorPerforms the element-wise logical XOR operation on the given input tensors. When self and other are of non-bool type, 0 is treated as False, and non-zero is treated as True.DefaultDefault
aclnnLogSumExpReturns the logarithm of the sum of exponentials of the input tensor along the specified dimensions.DefaultDefault
aclnnLtScalar&aclnnInplaceLtScalarDetermines whether each element in the input self is less than the input other value, and returns a Bool-type tensor.DefaultDefault
aclnnLtTensor&aclnnInplaceLtTensorDetermines whether each element in the input self is less than the corresponding element in the input other, and returns a Bool-type tensor.DefaultDefault
aclnnMaskedScalePerforms element-wise computation.DefaultDefault
aclnnMaskedSelectSelects elements from the input tensor (self) based on a Boolean mask tensor (mask) as the output, forming a new one-dimensional tensor.DefaultDefault
aclnnMatmulCompressDequantWhen performing l@r matrix multiplication, the r matrix can be losslessly compressed using the msModelSlim tool to reduce its memory footprint, and then this API completes lossless decompression, matrix multiplication, and dequantization.--
aclnnMaxDimReturns the maximum values and their indices along the specified dimension of the tensor.DefaultDefault
aclnnMaxReturns the maximum value among all elements of the tensor.DefaultDefault
aclnnMaximumComputes the element-wise maximum of two tensors and returns a new tensor.DefaultDefault
aclnnMaxNComputes the element-wise maximum across the corresponding elements of each input tensor in the input tensor list.DefaultDefault
aclnnMaxV2Computes the element-wise maximum of the input tensor along the specified dimension.DefaultDefault
aclnnMeanComputes the mean of the tensor along the specified dimensions.DefaultDefault
aclnnMeanV2Computes the mean of the tensor along the specified dimensions.DefaultDefault
aclnnMinReturns the minimum value among all elements of the tensor.DefaultDefault
aclnnMinDimReturns the minimum values and their indices along the specified dimension of self.DefaultDefault
aclnnMinimumComputes the element-wise minimum of two tensors and returns a new tensor.DefaultDefault
aclnnMinNComputes the element-wise minimum across the corresponding elements of each input tensor in the input tensor list.DefaultDefault
aclnnMul&aclnnInplaceMulPerforms multiplication between tensors.DefaultDefault
aclnnMuls&aclnnInplaceMulsPerforms multiplication between a tensor and a scalar.DefaultDefault
aclnnMultinomialDraws numsamples samples from the input tensor based on the probability distribution of each object, and stores the indices of these samples in the output tensor.DefaultDefault
aclnnMultinomialTensorDraws numsamples samples from the input tensor based on the probability distribution of each object, and stores the indices of these samples in the output tensor.Default-
aclnnNanToNum&aclnnInplaceNanToNumReplaces NaN, positive infinity, and negative infinity values in the input with the values specified by nan, posinf, and neginf, respectively.DefaultDefault
aclnnNeg&aclnnInplaceNegComputes the negation of each element of the input.DefaultDefault
aclnnNeScalar&aclnnInplaceNeScalarComputes whether the value of each element in selfRef is not equal to the value of other.DefaultDefault
aclnnNeTensor&aclnnInplaceNeTensorComputes whether the value of each element in self (selfRef) is not equal to the corresponding value in other.DefaultDefault
aclnnNormalFloatFloatReturns a tensor of random numbers drawn from independent normal distributions with the given mean (float) and standard deviation (float).Default
aclnnNormalFloatTensorReturns a tensor of random numbers drawn from independent normal distributions with the given mean (float) and standard deviation (tensor).DefaultDefault
aclnnNormalTensorFloatReturns a tensor of random numbers drawn from independent normal distributions with the given mean (tensor) and standard deviation (float).DefaultDefault
aclnnNormalTensorTensorReturns a random number drawn from independent normal distributions with the given mean (tensor) and standard deviation (tensor).DefaultDefault
aclnnNpuFormatCastPerforms ND ↔ NZ format conversion.Default
aclnnOneHotApplies one-hot encoding to the input self of length n, producing an output out with n*k elements.DefaultDefault
aclnnPdistComputes the p-norm distance between each pair of row vectors in the input self.Default-
aclnnPdistForwardComputes the p-norm distance of each pair of row vectors in the input self.Default-
aclnnPermutePermutes arbitrary dimensions of a tensor. For example, if the input self is a tensor with shape [2, 3, 5] and dims is (2, 0, 1), the output is a tensor with shape [5, 2, 3].DefaultDefault
aclnnPolarConverts the absolute value and angle of the input to Cartesian coordinates, producing a complex tensor out.Default-
aclnnPowScalarTensorRaises each element of exponent to the power of the corresponding element in input.DefaultDefault
aclnnPowTensorScalar&aclnnInplacePowTensorScalarRaises each element of exponent to the power of the corresponding element in input.DefaultDefault
aclnnPowTensorTensor&aclnnInplacePowTensorTensorRaises each element of exponent to the power of the corresponding element in input.DefaultDefault
aclnnPrecisionCompareCompares whether elements of two tensors are identical for precision comparison, and returns the status code of the operator execution without triggering management plane fault reporting.DefaultDefault
aclnnProdReturns the product of all elements in the input tensor.DefaultDefault
aclnnProdDimReturns the product of each row along the given dimension of the input tensor.DefaultDefault
aclnnQrPerforms orthogonal decomposition on the input tensor.Default-
aclnnRandpermReturns a random permutation of integers from 0 to n-1.DefaultDefault
aclnnRangeGenerates values from start to end with a step interval.DefaultDefault
aclnnRealExtracts the real part of each element in the input tensor.Default-
aclnnReciprocal&aclnnInplaceReciprocalReturns a new tensor with the reciprocal of each input element.DefaultDefault
aclnnReduceLogSumReturns the logarithm of the sum of each row in the input tensor along the given dimension.Default-
aclnnReduceNansumTreats NaN values in the tensor as 0, then returns the sum of the input tensor along the given dimension.Default-
aclnnReduceSumReturns the sum of each row in the input tensor along the given dimension.DefaultDefault
aclnnReflectionPad1dPads the input tensor using the reflection of the input boundary.DefaultDefault
aclnnReflectionPad2dPads the input tensor using the reflection of the input boundary.DefaultDefault
aclnnReflectionPad3dPerforms 3D reflection padding.DefaultDefault
aclnnRemainderScalarTensorBroadcasts the scalar self to a tensor with the same shape as tensor other, then converts each element to the remainder obtained by dividing by the corresponding element of other.DefaultDefault
aclnnRemainderTensorScalar&aclnnInplaceRemainderTensorScalarConverts each element in tensor self to the remainder obtained by dividing by the scalar other.DefaultDefault
aclnnRemainderTensorTensor&aclnnInplaceRemainderTensorTensorBroadcasts tensor self and tensor other to a consistent shape, then converts each element to the remainder obtained by dividing by the corresponding element of other.DefaultDefault
aclnnRepeatRepeats the input tensor along each dimension according to the replication counts specified in repeats.DefaultDefault
aclnnReplicationPad1dPads the last dimension of the input tensor using the input boundary.DefaultDefault
aclnnReplicationPad2dPads the last two dimensions of the input tensor using the input boundary.DefaultDefault
aclnnReplicationPad3dPads the last three dimensions of the input tensor using the input boundary.DefaultDefault
aclnnReflectionPad1dInvokes the mirror_pad operator in REFLECT mode to pad the last dimension of the input tensor.DefaultDefault
aclnnReflectionPad2dInvokes the mirror_pad operator in REFLECT mode to pad the last two dimensions of the input tensor.DefaultDefault
aclnnReflectionPad3dInvokes the mirror_pad operator in REFLECT mode to pad the last three dimensions of the input tensor.DefaultDefault
aclnnReplicationPad1dBackwardComputes the backward propagation of replication_pad1d.DefaultDefault
aclnnReplicationPad2dBackwardComputes the backward propagation of replication_pad2d. For forward computation, see aclnnReplicationPad2d.DefaultDefault
aclnnReplicationPad3dBackwardComputes the backward propagation of aclnnReplicationPad3d.DefaultDefault
aclnnReflectionPad1dBackwardComputes the backward propagation of reflection_pad1d. For forward computation, see aclnnReflectionPad1d.DefaultDefault
aclnnReflectionPad2dBackwardComputes the backward propagation of reflection_pad2d. For forward computation, see aclnnReflectionPad2d.DefaultDefault
aclnnReflectionPad3dBackwardComputes the backward propagation of the aclnnReflectionPad3d API.DefaultDefault
aclnnRightShiftPerforms a bitwise right shift on each element of the input tensor input according to the corresponding position parameter in the input tensor shiftBits.DefaultDefault
aclnnRollShifts data in the tensor along given sizes and dimensions.DefaultDefault
aclnnRound&aclnnInplaceRoundRounds the input value to the nearest integer. If the value is equidistant from two integers, rounds to the nearest even integer.DefaultDefault
aclnnRoundDecimals&aclnnInplaceRoundDecimalsRounds the elements of the input tensor to the specified number of decimal places.DefaultDefault
aclnnRsqrt&aclnnInplaceRsqrtComputes the reciprocal of the square root of each element in input (Tensor).DefaultDefault
aclnnRsubPerforms subtraction.DefaultDefault
aclnnRsubsPerforms subtraction.DefaultDefault
aclnnScaleSee the operator documentation.Default-
aclnnSearchSortedFinds the indices where the given tensor values (self) should be inserted in a sorted tensor (sortedSequence).Default-
aclnnSearchSortedsFinds the index where the given scalar value (self) should be inserted in a sorted one-dimensional tensor (sortedSequence). Returns a tensor with shape [1] indicating the position where the given scalar value should be inserted in the original tensor. If self is of Tensor type, see the document aclnnSearchSorted.Default-
aclnnSignApplies the Sign function element-wise to the input tensor and outputs the result tensor.DefaultDefault
aclnnSignbitDetermines whether the sign bit of each element in the input is 1, and returns a bool-type tensor.DefaultDefault
aclnnSignBitsPackPacks 1-bit Adam of float16 or float32 type into uint8.Default-
aclnnSignBitsUnpackUnpacks uint8-type 1-bit Adam into float32 or float16.Default-
aclnnSilentCheckCompares the input feature value (val) against absolute and relative thresholds to identify whether a silent detection fault is triggered.Default-
aclnnSilentCheckV2Identifies whether a silent detection fault is triggered based on the stepRef parameter and the Markov inequality threshold.Default-
aclnnSimThreadExponentialGenerates random numbers following an exponential distribution with parameter lambda and fills them into the selfRef tensor.Default-
aclnnSin&aclnnInplaceSinPerforms the sin operation on the input tensor.DefaultDefault
aclnnSinc&aclnnInplaceSincPerforms the sinc operation on the input tensor.Default-
aclnnSinh&aclnnInplaceSinhPerforms the sinh operation on the input tensor.Default-
aclnnSinkhornComputes the Sinkhorn distance, which can be used for expert routing in MoE models.Default-
aclnnSliceExtracts a sub-tensor out from the input tensor self along the specified dimension dim, based on the given range [start, end] and step size step.DefaultDefault
aclnnSliceV2Extracts a tensor out from the input tensor self based on the given axes, ranges [starts, ends], and step sizes steps.DefaultDefault
aclnnSlogdetComputes the sign and natural logarithm of the determinant of the input self.DefaultDefault
aclnnSortSorts the elements in the input tensor in ascending or descending order along the specified dimension, and returns the corresponding index values.DefaultDefault
aclnnSplitTensorSplits the input self evenly along the dim axis according to the splitSections size.DefaultDefault
aclnnSplitWithSizeSplits the input self along the dim axis into segments of sizes specified by each element in splitSize.DefaultDefault
aclnnSqrt&aclnnInplaceSqrtComputes the square root of non-negative numbers. Returns NaN for negative inputs.DefaultDefault
aclnnSquareComputes the square of each element in the input tensor.DefaultDefault
aclnnStackConcatenates a sequence of tensors along a new dimension.DefaultDefault
aclnnStdComputes the standard deviation along the specified dimension (dim), which can be a single dimension, a list of dimensions, or None.DefaultDefault
aclnnStdMeanCorrectionComputes the sample standard deviation and mean.DefaultDefault
aclnnStridedSliceStridedSliceAssign is a tensor slice assignment operation that extracts a sub-tensor from the input tensor according to the specified start, end positions, and stride.DefaultDefault
aclnnStridedSliceAssignV2StridedSliceAssign is a tensor slice assignment operation that assigns the content of the tensor inputValue to the specified positions in the target tensor varRef.DefaultDefault
aclnnSub&aclnnInplaceSubPerforms subtraction, with the subtrahend scaled by alpha.DefaultDefault
aclnnSubs&aclnnInplaceSubsPerforms subtraction, with the subtrahend scaled by alpha.DefaultDefault
aclnnSumReturns the result of sequentially performing add summation on each input tensor in the input tensors list.Default-
aclnnSvdComputes the singular value decomposition of one or more matrices.Default-
aclnnSWhereSelects elements from self or other based on a condition and returns the result (broadcasting is supported).DefaultDefault
aclnnTan&aclnnInplaceTanComputes the tangent of each element in the input tensor self and stores the result in the output tensor out.Default-
aclnnTanh&aclnnInplaceTanhAn activation function. Returns a tensor with the same shape as the input tensor, performing element-wise computation on the input tensor.DefaultDefault
aclnnTanhBackwardComputes the backward propagation of aclnnTanh.DefaultDefault
aclnnTopkReturns the k extreme values and their indices of the input tensor along the specified dimension.DefaultDefault
aclnnTraceComputes the sum of the elements on the main diagonal starting from the top-left corner of the matrix.Default-
aclnnTransformBiasRescaleQkvThe TransformBiasRescaleQkv operator is an API for processing Query, Key, and Value vectors in multi-head attention mechanisms.Default
aclnnTransConvolutionWeightUsed in conjunction with the aclnnCalculateConvolutionWeightSize API to create a weight tensor that is performance-friendly for the Convolution operator.Default-
aclnnTransMatmulWeightUsed in conjunction with the aclnnCalculateMatmulWeightSize and aclnnCalculateMatmulWeightSizeV2 APIs to create a weight tensor that is performance-friendly for the Matmul operator.Default
aclnnTriangularSolveSolves a system of equations with a square upper or lower triangular invertible matrix A and multiple right-hand sides b.DefaultDefault
aclnnTril&aclnnInplaceTrilZeros out the upper-right part of the last two dimensions (counted from left to right by shape) of the input self tensor along the diagonal.DefaultDefault
aclnnTriu&aclnnInplaceTriuZeros out the lower-left part of the last two dimensions (counted from left to right by shape) of the input self tensor along the diagonal.DefaultDefault
aclnnTrunc&aclnnInplaceTruncPerforms the trunc operation on the input tensor (truncates the fractional part of the number and returns the integer part).DefaultDefault
aclnnUnfoldGradImplements the backward function of the Unfold operator and computes the corresponding gradient.Default
aclnnVarReturns the variance computed from the values of the input tensor along the specified dimension.DefaultDefault
aclnnVarCorrectionReturns the variance computed from the values of the input tensor along the specified dimension.DefaultDefault
aclnnVarMeanReturns the mean and variance computed from the values of the input tensor along the specified dimension.DefaultDefault
aclnnXLogYScalarOther&aclnnInplaceXLogYScalarOtherComputes the result of self * log(other).Default-
aclnnXLogYScalarSelfComputes the result of self * log(other).Default-
aclnnXLogYTensor&aclnnInplaceXLogYTensorComputes the result of self * log(other).Default-
aclRfft1DPerforms RFFT (Fourier transform) computation on the input tensor self, producing a complex tensor containing non-negative frequencies.Default-
aclStftComputes the Fourier transform of the input within sliding windows.Default-