diff --git a/frameworks/native/neural_network_runtime/ops/unstack_builder.cpp b/frameworks/native/neural_network_runtime/ops/unstack_builder.cpp index 9d1431a8c3461ba605d6a3656f8593112c2ed2ee..3991bf4d8234d2c4251c563874f050dc7826f751 100755 --- a/frameworks/native/neural_network_runtime/ops/unstack_builder.cpp +++ b/frameworks/native/neural_network_runtime/ops/unstack_builder.cpp @@ -75,15 +75,15 @@ OH_NN_ReturnCode UnstackBuilder::Build(const std::vector& paramsIndex, return index >= allTensorsSize; }); if (isOverTensorSize) { - LOGE("The index of inputs is out of range."); + LOGE("[Unstack] The index of inputs is out of range."); return OH_NN_INVALID_PARAMETER; } - isOverTensorSize = std::any_of(inputsIndex.begin(), inputsIndex.end(), [allTensorsSize](uint32_t index) { + isOverTensorSize = std::any_of(outputsIndex.begin(), outputsIndex.end(), [allTensorsSize](uint32_t index) { return index >= allTensorsSize; }); if (isOverTensorSize) { - LOGE("The index of outputs is out of range."); + LOGE("[Unstack] The index of outputs is out of range."); return OH_NN_INVALID_PARAMETER; } diff --git a/interfaces/kits/c/neural_network_runtime/neural_network_runtime_type.h b/interfaces/kits/c/neural_network_runtime/neural_network_runtime_type.h index 23d461dd7d22a392bb17bf77c773a3a1ce2a1df5..69692159a86f9d4c4ee4fc40eb0c140bc0f4fcb7 100644 --- a/interfaces/kits/c/neural_network_runtime/neural_network_runtime_type.h +++ b/interfaces/kits/c/neural_network_runtime/neural_network_runtime_type.h @@ -27,7 +27,7 @@ * @file neural_network_runtime_type.h * * @brief Defines the structure and enumeration. - * + * * include "neural_network_runtime/neural_network_runtime_type.h" * @library libneural_network_runtime.so * @kit Neural Network Runtime Kit @@ -188,15 +188,15 @@ typedef enum { /** * @brief Defines the callback function handle for the post-process when the asynchronous execution has been done. - * + * * Use userData to identify the asynchronous execution you want to get. * It is the argument userData passed to {@link OH_NNExecutor_RunAsync}.\n - * + * * Use errCode of type {@link OH_NN_ReturnCode} to get the error code returned by the asynchronous execution.\n - * + * * The outputTensor and outputCount are the inference results, which is the same as ones passed to * {@link OH_NNExecutor_RunAsync}.\n - * + * * @param userData Asynchronous execution identifier, which is the argument userData passed to * {@link OH_NNExecutor_RunAsync}. * @param errCode Error code {@link OH_NN_ReturnCode} returned by the asynchronous execution. @@ -212,12 +212,12 @@ typedef void (*NN_OnRunDone)(void *userData, OH_NN_ReturnCode errCode, void *out /** * @brief Defines the callback function handle for the post-process when the device driver service is dead during * asynchronous execution. - * + * * You should recompile the model if this callback function is called.\n - * + * * Use userData to identify the asynchronous execution you want to get. * It is the argument userData passed to {@link OH_NNExecutor_RunAsync}.\n - * + * * @param userData Asynchronous execution identifier, which is the argument userData passed to * {@link OH_NNExecutor_RunAsync}. * @since 11 @@ -329,13 +329,13 @@ typedef enum { * * Parameters: * - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * Outputs: * - * * output: sum of input1 and input2. - * The data shape is the same as that of the input after broadcasting, + * * output: sum of input1 and input2. + * The data shape is the same as that of the input after broadcasting, * and the data type is the same as that of the input with a higher precision. */ OH_NN_OPS_ADD = 1, @@ -366,7 +366,7 @@ typedef enum { * Otherwise, the last additional padding will be completed from the bottom and right. * 1 (valid): The possible maximum height and width of the output will be returned in case of no * padding. Excessive pixels will be discarded. - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * global Whether to do global pooling. * * roundMode Boundary handling method. When the pool cannot completely cover the input feature map, @@ -388,7 +388,7 @@ typedef enum { * and the second number indicates the moving step in width. * * padList: padding around input. It is an int array [top, bottom, left, right], * and the nearest neighbor values are used for padding. - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * global Whether to do global pooling. * * roundMode Boundary handling method. When the pool cannot completely cover the input feature map, @@ -535,7 +535,7 @@ typedef enum { * * group: number of groups in which the input is divided by inChannel. The value is of the * int type. If group is 1, it is a conventional convolution. If group is greater * than 1 and less than or equal to inChannel, it is a group convolution. - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * If the input contains the padList parameter: @@ -564,7 +564,7 @@ typedef enum { * If group is inChannel, it is depthwiseConv2d. In this case, group==inChannel==outChannel. * If group is greater than 1 and less than inChannel, it is a group convolution. * In this case, outChannel==group. - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * Outputs: @@ -611,7 +611,7 @@ typedef enum { * It can be a single integer to specify the same value for all spatial dimensions. The amount of output * padding along a dimension must be less than the stride along this dimension. * - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * If the input contains the padList parameter: @@ -641,7 +641,7 @@ typedef enum { * It can be a single integer to specify the same value for all spatial dimensions. The amount of output * padding along a dimension must be less than the stride along this dimension. * - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * Outputs: @@ -680,7 +680,7 @@ typedef enum { * * 1 (valid): The possible maximum height and width of the output will be returned in case of no * padding. The excessive pixels will be discarded. - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * If the input contains the padList parameter: @@ -692,7 +692,7 @@ typedef enum { * outChannel is equal to channelMultiplier multiplied by inChannel. * * bias: bias of the convolution. It is an array with a length of [outChannel]. * In quantization scenarios, the bias parameter does not require quantization parameters. - * The quantization version requires data input of the OH_NN_INT32 type. + * The quantization version requires data input of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. * * Parameters: @@ -703,7 +703,7 @@ typedef enum { * It is an int array [dilationHeight, dilationWidth]. The value must be greater than * or equal to 1 and cannot exceed the height and width of input. * * padList: padding around input. It is an int array [top, bottom, left, right]. - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * Outputs: @@ -725,7 +725,7 @@ typedef enum { * * Parameters: * - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * Outputs: @@ -749,7 +749,7 @@ typedef enum { * * Outputs: * - * * output: computing result, which has the same data type and shape of input1 and input2. + * * output: computing result, which has the same data type and shape of input1. */ OH_NN_OPS_ELTWISE = 12, @@ -796,7 +796,7 @@ typedef enum { * * Parameters: * - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * hasBias Whether to use the bias. * @@ -818,7 +818,7 @@ typedef enum { * * * axis: axis in which the full connection is applied. The specified axis and its following axes are * converted into a 1D tensor for applying the full connection. - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * useAxis Whether to use the axis. * * hasBias Whether to use the bias. @@ -889,7 +889,7 @@ typedef enum { * * * TransposeX: Boolean value indicating whether to transpose input1. * * TransposeY: Boolean value indicating whether to transpose input2. - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * Outputs: @@ -897,7 +897,7 @@ typedef enum { * * output: inner product obtained after calculation. In case of type!=NN_UNKNOWN, the output data type is * determined by type. In case of type==NN_UNKNOWN, the output data type depends on the data type * converted during computing of inputX and inputY. - * + * */ OH_NN_OPS_MATMUL = 19, @@ -944,7 +944,7 @@ typedef enum { * right if possible. Otherwise, the last additional padding will be completed from the bottom and right. * 1 (valid): The possible maximum height and width of the output will be returned in case of * no padding. The excessive pixels will be discarded. - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * global Whether to do global pooling. * * roundMode Boundary handling method. When the pool cannot completely cover the input feature map, @@ -963,7 +963,7 @@ typedef enum { * * strides indicates the distance of kernel moving. The value is an int array * [strideHeight, strideWidth]. The first number indicates the moving step in height, * and the second number indicates the moving step in width. - * * padList: padding around input. It is an int array [top, bottom, left, right], + * * padList: padding around input. It is an int array [top, bottom, left, right], * and the nearest neighbor values are used for padding. * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. @@ -978,8 +978,8 @@ typedef enum { OH_NN_OPS_MAX_POOL = 21, /** - * Multiplies elements in the same positions of inputX and inputY to obtain the output. - * If inputX and inputY have different shapes, expand them to the same shape + * Multiplies elements in the same positions of input1 and input2 to obtain the output. + * If input1 and input2 have different shapes, expand them to the same shape * through broadcast and then perform multiplication. * * Inputs: @@ -989,7 +989,7 @@ typedef enum { * * Parameters: * - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * Outputs: @@ -1015,7 +1015,7 @@ typedef enum { * Parameters: * * * axis: integer scalar that specifies the dimension for inserting the one-hot. Assume that the shape - * of indices is [N, C], and the value of depth is D. + * of indices is [N, C], and the value of depth is D. * When axis is 0, the shape of the output is [D, N, C]. * When axis is -1, the shape of the output is [N, C, D]. * When axis is 1, the shape of the output is [N, D, C]. @@ -1086,7 +1086,7 @@ typedef enum { * Parameters: * * * axis: dimensions to be scaled. - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * Outputs: @@ -1130,7 +1130,7 @@ typedef enum { * * * input: n-dimensional input tensor. * * begin: start of the slice, which is an array of integers greater than or equal to 0. - * * size: slice length, which is an array of integers greater than or equal to 0. + * * size: slice length, which is an array of integers greater than or equal to 0. * Assume that a dimension is i and 1<=size[i]<=input.shape[i]-begin[i]. * * Parameters: @@ -1139,7 +1139,7 @@ typedef enum { * * Outputs: * - * * output: n-dimensional tensor obtained by slicing. + * * output: n-dimensional tensor obtained by slicing. * The TensorType, shape, and size of the output are the same as those of the input. */ OH_NN_OPS_SLICE = 29, @@ -1174,7 +1174,7 @@ typedef enum { * Parameters: * * * blockShape: a pair of integers. Each of them is greater than or equal to 1. - * * paddings: a pair of arrays. Each of them consists of two integers. The four integers that form + * * paddings: a pair of arrays. Each of them consists of two integers. The four integers that from * paddings must be greater than or equal to 0. paddings[0][0] and paddings[0][1] * specify the number of paddings in the third dimension, and paddings[1][0] and paddings[1][1] * specify the number of paddings in the fourth dimension. @@ -1212,7 +1212,7 @@ typedef enum { * * Outputs: * - * * outputs: array of n-dimensional tensors, with the same data type and dimensions. + * * outputs: array of n-dimensional tensors, with the same data type and dimensions. * The data type of each tensor is the same as that of input. */ OH_NN_OPS_SPLIT = 32, @@ -1303,7 +1303,7 @@ typedef enum { * * input: n-dimensional input tensor. * * begin: start of slicing, which is a 1D tensor. The length of begin is n. * begin[i] specifies the start of slicing in the ith dimension. - * * end: end of slicing, which is a 1D tensor. The length of end is n. + * * end: end of slicing, which is a 1D tensor. The length of end is n. * end[i] specifies the end of slicing in the ith dimension. * * strides: slicing stride, which is a 1D tensor. The length of strides is n. * strides[i] specifies the stride at which the tensor is sliced in the ith dimension. @@ -1313,16 +1313,16 @@ typedef enum { * * beginMask: an integer used to mask begin. beginMask is represented in binary code. * In case of binary(beginMask)[i]==1, for the ith dimension, * elements are sliced from the first element at strides[i] until the end[i]-1 element. - * - * * endMask: an integer used to mask end. endMask is represented in binary code. + * + * * endMask: an integer used to mask end. endMask is represented in binary code. * In case of binary(endMask)[i]==1, elements are sliced from the element at the begin[i] position * in the ith dimension until the tensor boundary at strides[i]. - * + * * * ellipsisMask: integer used to mask begin and end. * ellipsisMask is represented in binary code. In case of binary(ellipsisMask)[i]==1, * elements are sliced from the first element at strides[i] in the ith dimension * until the tensor boundary. Only one bit of binary(ellipsisMask) can be a non-zero value. - * + * * * newAxisMask: new dimension, which is an integer. newAxisMask is represented in binary code. * In case of binary(newAxisMask)[i]==1, * a new dimension whose length is 1 is inserted into the ith dimension. @@ -1347,7 +1347,7 @@ typedef enum { * * Parameters: * - * * activationType is an integer constant which is contained in FuseType. + * * activationType is an integer constant which is contained in OH_NN_FuseType. * The specified activation function is called before output. * * Outputs: @@ -1396,18 +1396,18 @@ typedef enum { OH_NN_OPS_TILE = 40, /** - * Transposes data of input 0 based on permutation. + * Transposes data of input based on permutation. * * Inputs: * * * input: n-dimensional tensor to be transposed. * * permutation: The value is a 1D tensor whose length is the same as the number of - * dimensions of input 0. + * dimensions of input. * * Outputs: * - * * output: n-dimensional tensor. TensorType of output 0 is the same as that of - * input 0, and the output shape is determined by the shape and permutation of input 0. + * * output: n-dimensional tensor. TensorType of output is the same as that of + * input, and the output shape is determined by the shape and permutation of input. */ OH_NN_OPS_TRANSPOSE = 41, @@ -1452,6 +1452,7 @@ typedef enum { * ratio of input after resizing. * * coordinateTransformMode: coordinate transformation method used by the resize operation. * The value is an int32 integer. Currently, the following methods are supported: + * 0 means ASYMMETRIC, 1 means ALIGN_CORNERS, 2 means HALF_PIXEL. * * excludeOutside: an int64 floating point number. When its value is 1, * the sampling weight of the part that * exceeds the boundary of input is set to 0, and other weights are normalized. @@ -1497,15 +1498,15 @@ typedef enum { * Inputs: * * * input: n-dimensional tensor. If n is greater than or equal to 2, - * inputX must be [BatchSize, ..., Channels]. The second dimension is the number of channels. + * input must be [BatchSize, ..., Channels]. The second dimension is the number of channels. * * weight: 1D tensor. The length of weight must be 1 or equal to the number of channels. * If the length of weight is 1, all channels share the same weight. * If the length of weight is equal to the number of channels, each channel exclusively has a weight. - * If n is less than 2 for inputX, the weight length must be 1. + * If n is less than 2 for input, the weight length must be 1. * * Outputs: * - * * output: PReLU activation value of x, with the same shape and data type as inputX. + * * output: PReLU activation value of input, with the same shape and data type as input. */ OH_NN_OPS_PRELU = 46, @@ -1587,14 +1588,14 @@ typedef enum { OH_NN_OPS_REDUCE_PROD = 50, /** - * Calculates the logical sum value for input tensor along the specified dimension. If keepDims is set to + * Calculates the logical and value for input tensor along the specified dimension. If keepDims is set to * false, the number of dimensions is reduced for the input; if keepDims is set to true, * the number of dimensions is retained. * * Inputs: * * * input: n-dimensional input tensor, where n is less than 8. - * * axis: dimension used to calculate the logical sum value. The value is a 1D tensor. + * * axis: dimension used to calculate the logical and value. The value is a 1D tensor. * The value range of each element in axis is [–n, n). * * Parameters: @@ -1620,8 +1621,8 @@ typedef enum { * * Parameters: * - * * src_t: data type of the input. - * * dst_t: data type of the output. + * * srcT: data type of the input. + * * dstT: data type of the output. * * axis: appoint the dimensions from which the quantization parameters are extracted. * If the size of the input tensor quantization parameter is 1, the operator function is * layer quantization conversion, and this parameter does not take effect. If the size of @@ -1646,7 +1647,7 @@ typedef enum { * Parameters: * * * sorted: order of sorting. The value true means descending and false means ascending. - * * axis: A OH_NN_INT32 scalar that specifies the dimension that needs to be sorted, default 0, + * * axis: A OH_NN_INT32 scalar that specifies the dimension that needs to be sorted, default -1, * pointing to the last dimension. * * Outputs: @@ -1948,17 +1949,17 @@ typedef enum { /** * Generate a tensor with given value and shape. - * + * * Inputs: * * * input: 1-dimensional tensor. Indicates the shape of the expected output tensor. * All values must be >= 0. - * + * * Parameters: * * * dataType: The data type of the output tensor. * * value: The value of the output elements. - * + * * Outputs: * * * output: A tensor, has the same shape as the input. @@ -2286,7 +2287,7 @@ typedef enum { * * Inputs: * - * * input: n-dimensional tensor with numeric data type。 + * * input: n-dimensional tensor with numeric data type. * * Outputs: * @@ -2380,7 +2381,7 @@ typedef enum { * @since 12 */ OH_NN_OPS_LOGICAL_OR = 89, - + /** * Returns element-wise smallest integer in not less than input. * @@ -2395,7 +2396,7 @@ typedef enum { * @since 12 */ OH_NN_OPS_CEIL = 90, - + /** * Crop given tensor acrodding to axis and offset. * @@ -2416,7 +2417,7 @@ typedef enum { * @since 12 */ OH_NN_OPS_CROP = 91, - + /** * The output of the object detection model is post-processed, including decoding the bounding box, * class probability and score of the model output, and then performing non-maximum suppression (NMS) @@ -2451,7 +2452,7 @@ typedef enum { * @since 12 */ OH_NN_OPS_DETECTION_POST_PROCESS = 92, - + /** * Returns element-wise largest integer not greater than x. * @@ -2466,7 +2467,7 @@ typedef enum { * @since 12 */ OH_NN_OPS_FLOOR = 93, - + /** * Calculate the L2-normalize of the input using the given axis. * @@ -2487,7 +2488,7 @@ typedef enum { * @since 12 */ OH_NN_OPS_L2_NORMALIZE = 94, - + /** * Computes the log-softmax function to n-dimensional input tensor. * The input is transformed by the Softmax function and then by the log function to lie in range[-inf,0). @@ -2507,7 +2508,7 @@ typedef enum { * @since 12 */ OH_NN_OPS_LOG_SOFTMAX = 95, - + /** * Normalize over local input regions. * @@ -2530,7 +2531,7 @@ typedef enum { * @since 12 */ OH_NN_OPS_LRN = 96, - + /** * Calculates the minimum of input1 and input2 element-wise. The inputs of input1 and * input2 comply with the implicit type conversion rules to make the data types are consistent. @@ -2551,7 +2552,7 @@ typedef enum { * @since 12 */ OH_NN_OPS_MINIMUM = 97, - + /** * Calculate the rank of a tensor. * The rank of a tensor is the number of indices required to uniquely select each element of the tensor. @@ -2567,7 +2568,7 @@ typedef enum { * @since 12 */ OH_NN_OPS_RANK = 98, - + /** * Calculates the maximum value for input tensor along the specified dimension. If keepDims is set to * false, the number of dimensions is reduced for the input; if keepDims is set to true, @@ -3572,7 +3573,7 @@ typedef struct OH_NN_Tensor { const int32_t *dimensions; /** Quantization information of the specified tensor. The data type must be {@link OH_NN_QuantParam}. */ const OH_NN_QuantParam *quantParam; - /** Specifies the tensor type. The value of type is related to the tensor usage. + /** Specifies the tensor type. The value of type is related to the tensor usage. * When the tensor is used as the input or output of the model, set type to {@link OH_NN_TENSOR}. * When a tensor is used as an operator parameter, select any enumerated value except {@link OH_NN_TENSOR} * from {@link OH_NN_TensorType}.