diff --git a/current.txt b/current.txt index e0923d6533..1108bebb2f 100644 --- a/current.txt +++ b/current.txt @@ -512,7 +512,7 @@ b83317b66721241887d2770b5ae95fd5af1e77c5daa7530ecb08fae8892f2b43 android.hardwar 92714960d1a53fc2ec557302b41c7cc93d2636d8364a44bd0f85be0c92927ff8 android.hardware.neuralnetworks@1.2::IExecutionCallback 36e1064c869965dee533c537cefbe87e54db8bd8cd45be7e0e93e00e8a43863a android.hardware.neuralnetworks@1.2::IPreparedModel e1c734d1545e1a4ae749ff1dd9704a8e594c59aea7c8363159dc258e93e0df3b android.hardware.neuralnetworks@1.2::IPreparedModelCallback -d734c2441b602da240fa0e9afe3b612cdc9f3ae9c1db13216f957861d0673c5e android.hardware.neuralnetworks@1.2::types +209a5ee694b94328afb2af2768f1fe6a69148e2cbb85ec3c340a36eed818c697 android.hardware.neuralnetworks@1.2::types cf7a4ba516a638f9b82a249c91fb603042c2d9ca43fd5aad9cf6c0401ed2a5d7 android.hardware.nfc@1.2::INfc abf98c2ae08bf765db54edc8068e36d52eb558cff6706b6fd7c18c65a1f3fc18 android.hardware.nfc@1.2::types 4cb252dc6372a874aef666b92a6e9529915aa187521a700f0789065c3c702ead android.hardware.power.stats@1.0::IPowerStats diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal index 7691642f75..8c577961cc 100644 --- a/neuralnetworks/1.2/types.hal +++ b/neuralnetworks/1.2/types.hal @@ -187,6 +187,10 @@ enum OperationType : int32_t { * input2.dimension = {5, 4, 3, 1} * output.dimension = {5, 4, 3, 2} * + * Since API level 29, generic zero-sized input tensor is supported. Zero + * dimension is only compatible with 0 or 1. The size of the output + * dimension is zero if either of corresponding input dimension is zero. + * * Supported tensor {@link OperandType}: * * {@link OperandType::TENSOR_FLOAT16} (since API level 29) * * {@link OperandType::TENSOR_FLOAT32} @@ -236,7 +240,8 @@ enum OperationType : int32_t { * * Inputs (explicit padding): * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying - * the input. + * the input. Since API level 29, zero batches is supported for this + * tensor. * * 1: An {@link OperandType::INT32} scalar, specifying the padding on * the left, in the ‘width’ dimension. * * 2: An {@link OperandType::INT32} scalar, specifying the padding on @@ -262,7 +267,8 @@ enum OperationType : int32_t { * * Inputs (implicit padding): * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying - * the input. + * the input. Since API level 29, zero batches is supported for this + * tensor. * * 1: An {@link OperandType::INT32} scalar, specifying the implicit * padding scheme, has to be one of the * following values: {0 (NONE), 1 (SAME), 2 (VALID)}. @@ -309,6 +315,7 @@ enum OperationType : int32_t { * Before API level 29, all input tensors of * {@link OperandType::TENSOR_QUANT8_ASYMM} * must have the same scale and zeroPoint as the output tensor. + * Since API level 29, zero-sized tensors are supported. * * n: An {@link OperandType::INT32} scalar, specifying the * concatenation axis. * @@ -366,7 +373,8 @@ enum OperationType : int32_t { * * Inputs (explicit padding): * * 0: A 4-D tensor, of shape [batches, height, width, depth_in], - * specifying the input. + * specifying the input. Since API level 29, zero batches is supported + * for this tensor. * * 1: A 4-D tensor, of shape * [depth_out, filter_height, filter_width, depth_in], specifying the * filter. For tensor of type @@ -413,7 +421,8 @@ enum OperationType : int32_t { * * Inputs (implicit padding): * * 0: A 4-D tensor, of shape [batches, height, width, depth_in], - * specifying the input. + * specifying the input. Since API level 29, zero batches is supported + * for this tensor. * * 1: A 4-D tensor, of shape * [depth_out, filter_height, filter_width, depth_in], specifying the * filter. For tensor of type @@ -675,7 +684,7 @@ enum OperationType : int32_t { * Supported tensor rank: up to 4 * * Inputs: - * * 0: A tensor. + * * 0: A tensor. Since API level 29, this tensor may be zero-sized. * * Outputs: * * 0: A tensor with the same shape as input0. @@ -768,7 +777,8 @@ enum OperationType : int32_t { * [batch_size, input_size], where "input_size" corresponds to the * number of inputs to the layer, matching the second dimension of * weights, and "batch_size" is calculated by dividing the number of - * elements by "input_size". + * elements by "input_size". Since API level 29, zero batch_size is + * supported for this tensor. * * 1: A 2-D tensor, specifying the weights, of shape * [num_units, input_size], where "num_units" corresponds to the number * of output nodes. @@ -864,6 +874,7 @@ enum OperationType : int32_t { * Supported tensor {@link OperandType}: * * {@link OperandType::TENSOR_FLOAT16} (since API level 29) * * {@link OperandType::TENSOR_FLOAT32} + * * {@link OperandType::TENSOR_QUANT8_ASYMM} (since API level 29) * * Supported tensor rank: up to 4 * Tensors with rank less than 4 are only supported since API level 29. @@ -878,6 +889,8 @@ enum OperationType : int32_t { * * Outputs: * * 0: A tensor of the same {@link OperandType} and same shape as input0. + * For {@link OperandType::TENSOR_QUANT8_ASYMM}, + * the scale must be 1.f / 128 and the zeroPoint must be 128. * * Available since API level 27. */ @@ -908,7 +921,8 @@ enum OperationType : int32_t { * * Inputs (explicit padding): * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying - * the input. + * the input. Since API level 29, zero batches is supported for this + * tensor. * * 1: An {@link OperandType::INT32} scalar, specifying the padding on * the left, in the ‘width’ dimension. * * 2: An {@link OperandType::INT32} scalar, specifying the padding on @@ -934,7 +948,8 @@ enum OperationType : int32_t { * * Inputs (implicit padding): * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying - * the input. + * the input. Since API level 29, zero batches is supported for this + * tensor. * * 1: An {@link OperandType::INT32} scalar, specifying the implicit * padding scheme, has to be one of the * following values: {0 (NONE), 1 (SAME), 2 (VALID)}. @@ -1024,7 +1039,8 @@ enum OperationType : int32_t { * Supported tensor rank: up to 4. * * Inputs: - * * 0: A tensor, specifying the input. + * * 0: A tensor, specifying the input. Since API level 29, this tensor may + * be zero-sized. * * Outputs: * * 0: The output tensor of same shape as input0. @@ -1336,7 +1352,8 @@ enum OperationType : int32_t { * * Inputs (explicit padding): * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying - * the input. + * the input. Since API level 29, zero batches is supported for this + * tensor. * * 1: An {@link OperandType::INT32} scalar, specifying the padding on * the left, in the ‘width’ dimension. * * 2: An {@link OperandType::INT32} scalar, specifying the padding on @@ -1362,7 +1379,8 @@ enum OperationType : int32_t { * * Inputs (implicit padding): * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying - * the input. + * the input. Since API level 29, zero batches is supported for this + * tensor. * * 1: An {@link OperandType::INT32} scalar, specifying the implicit * padding scheme, has to be one of the * following values: {0 (NONE), 1 (SAME), 2 (VALID)}. @@ -1409,6 +1427,10 @@ enum OperationType : int32_t { * * {@link OperandType::TENSOR_FLOAT32} * * {@link OperandType::TENSOR_QUANT8_ASYMM} * + * Since API level 29, generic zero-sized input tensor is supported. Zero + * dimension is only compatible with 0 or 1. The size of the output + * dimension is zero if either of corresponding input dimension is zero. + * * Supported tensor rank: up to 4 * * Inputs: @@ -1444,7 +1466,8 @@ enum OperationType : int32_t { * Supported tensor rank: up to 4. * * Inputs: - * * 0: A tensor, specifying the input. + * * 0: A tensor, specifying the input. Since API level 29, this tensor may + * be zero-sized. * * Outputs: * * 0: The output tensor of same shape as input0. @@ -1468,7 +1491,8 @@ enum OperationType : int32_t { * Supported tensor rank: up to 4. * * Inputs: - * * 0: A tensor, specifying the input. + * * 0: A tensor, specifying the input. Since API level 29, this tensor may + * be zero-sized. * * Outputs: * * 0: The output tensor of same shape as input0. @@ -1492,7 +1516,8 @@ enum OperationType : int32_t { * Supported tensor rank: up to 4. * * Inputs: - * * 0: A tensor, specifying the input. + * * 0: A tensor, specifying the input. Since API level 29, this tensor may + * be zero-sized. * * Outputs: * * 0: The output tensor of same shape as input0. @@ -1544,9 +1569,12 @@ enum OperationType : int32_t { * [batch, height, width, channels]. Alternatively, the data layout could * be NCHW, the data storage order of: [batch, channels, height, width]. * - * Inputs: + * Both resizing by shape and resizing by scale are supported. + * + * Inputs (resizing by shape): * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying - * the input. + * the input. Since API level 29, zero batches is supported for this + * tensor. * * 1: An {@link OperandType::INT32} scalar, specifying the output * height of the output tensor. * * 2: An {@link OperandType::INT32} scalar, specifying the output @@ -1555,6 +1583,24 @@ enum OperationType : int32_t { * Set to true to specify NCHW data layout for input0 and output0. * Available since API level 29. * + * Inputs (resizing by scale, since API level 29): + * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying + * the input. Zero batches is supported for this tensor. + * * 1: A scalar, specifying height_scale, the scaling factor of the height + * dimension from the input tensor to the output tensor. The output + * height is calculated as new_height = floor(height * height_scale). + * The scalar must be of {@link OperandType::FLOAT16} if input0 is + * of {@link OperandType::TENSOR_FLOAT16} and of + * {@link OperandType::FLOAT32} otherwise. + * * 2: A scalar, specifying width_scale, the scaling factor of the width + * dimension from the input tensor to the output tensor. The output + * width is calculated as new_width = floor(width * width_scale). + * The scalar must be of {@link OperandType::FLOAT16} if input0 is + * of {@link OperandType::TENSOR_FLOAT16} and of + * {@link OperandType::FLOAT32} otherwise. + * * 3: An optional {@link OperandType::BOOL} scalar, default to false. + * Set to true to specify NCHW data layout for input0 and output0. + * * Outputs: * * 0: The output 4-D tensor, of shape * [batches, new_height, new_width, depth]. @@ -1640,7 +1686,8 @@ enum OperationType : int32_t { * Tensors with rank other than 2 or 4 are only supported since API level 29. * * Inputs: - * * 0: A 2-D or 4-D tensor, specifying the tensor to be reshaped. + * * 0: A 2-D or 4-D tensor, specifying the tensor to be reshaped. Since + * API level 29, this tensor may be zero-sized. * * 1: A scalar, specifying the positive scaling factor for the exponent, * beta. If input0 is of {@link OperandType::TENSOR_FLOAT32} or * {@link OperandType::TENSOR_QUANT8_ASYMM}, the scalar must be of @@ -1798,7 +1845,8 @@ enum OperationType : int32_t { * Supported tensor rank: up to 4. * * Inputs: - * * 0: A tensor, specifying the input. + * * 0: A tensor, specifying the input. Since API level 29, this tensor may + * be zero-sized. * * Outputs: * * 0: The output tensor of same shape as input0. @@ -1865,6 +1913,10 @@ enum OperationType : int32_t { * input2.dimension = {5, 4, 3, 1} * output.dimension = {5, 4, 3, 2} * + * Since API level 29, generic zero-sized input tensor is supported. Zero + * dimension is only compatible with 0 or 1. The size of the output + * dimension is zero if either of corresponding input dimension is zero. + * * Supported tensor {@link OperandType}: * * {@link OperandType::TENSOR_FLOAT16} (since API level 29) * * {@link OperandType::TENSOR_FLOAT32} @@ -2098,6 +2150,10 @@ enum OperationType : int32_t { * input2.dimension = {5, 4, 3, 1} * output.dimension = {5, 4, 3, 2} * + * Since API level 29, generic zero-sized input tensor is supported. Zero + * dimension is only compatible with 0 or 1. The size of the output + * dimension is zero if either of corresponding input dimension is zero. + * * Supported tensor {@link OperandType}: * * {@link OperandType::TENSOR_FLOAT16} (since API level 29) * * {@link OperandType::TENSOR_FLOAT32} @@ -2138,6 +2194,7 @@ enum OperationType : int32_t { * * Inputs: * * 0: An n-D tensor, specifying the tensor to be transposed. + * Since API level 29, this tensor may be zero-sized. * * 1: An optional 1-D Tensor of {@link OperandType::TENSOR_INT32}, * the permutation of the dimensions of the input tensor. * @@ -2234,7 +2291,8 @@ enum OperationType : int32_t { * * 0: A 2-D Tensor of shape [num_rois, 4], specifying the locations of the * bounding box proposals, each line with format [x1, y1, x2, y2]. * For tensor of type {@link OperandType::TENSOR_QUANT16_ASYMM}, - * the zeroPoint must be 0 and the scale must be 0.125. + * the zeroPoint must be 0 and the scale must be 0.125. Zero num_rois + * is supported for this tensor. * * 1: A 2-D Tensor of shape [num_rois, num_classes * 4], specifying the * bounding box delta for each region of interest and each class. The * bounding box deltas are organized in the following order @@ -2243,10 +2301,12 @@ enum OperationType : int32_t { * and height, dw and dh is the log-scale relative correction factor * for the width and height. For input0 of type * {@link OperandType::TENSOR_QUANT16_ASYMM}, this tensor should be - * of {@link OperandType::TENSOR_QUANT8_ASYMM}. + * of {@link OperandType::TENSOR_QUANT8_ASYMM}. Zero num_rois is + * supported for this tensor. * * 2: An 1-D {@link OperandType::TENSOR_INT32} tensor, of shape * [num_rois], specifying the batch index of each box. Boxes with - * the same batch index are grouped together. + * the same batch index are grouped together. Zero num_rois is + * supported for this tensor. * * 3: A 2-D Tensor of shape [batches, 2], specifying the information of * each image in the batch, each line with format * [image_height, image_width]. @@ -2580,10 +2640,17 @@ enum OperationType : int32_t { /** * Greedily selects a subset of bounding boxes in descending order of score. * - * This op applies hard NMS algorithm to each class. In each loop of - * execution, the box with maximum score gets selected, and any boxes with - * the intersection-over-union (IOU) greater than a threshold are removed - * from the pending set. + * This op applies NMS algorithm to each class. In each loop of execution, + * the box with maximum score gets selected and removed from the pending set. + * The scores of the rest of boxes are lowered according to the + * intersection-over-union (IOU) overlapping with the previously selected + * boxes and a specified NMS kernel method. Any boxes with score less + * than a threshold are removed from the pending set. + * + * Three NMS kernels are supported: + * * Hard: score_new = score_old * (1 if IoU < threshold else 0) + * * Linear: score_new = score_old * (1 if IoU < threshold else 1 - IoU) + * * Gaussian: score_new = score_old * exp(- IoU^2 / sigma) * * Axis-aligned bounding boxes are represented by its upper-left corner * coordinate (x1,y1) and lower-right corner coordinate (x2,y2). A valid @@ -2597,25 +2664,34 @@ enum OperationType : int32_t { * Inputs: * * 0: A 2-D Tensor of shape [num_rois, num_classes], specifying the score * of each bounding box proposal. The boxes are grouped by batches in the - * first dimension. + * first dimension. Zero num_rois is supported for this tensor. * * 1: A 2-D Tensor specifying the bounding boxes of shape * [num_rois, num_classes * 4], organized in the order [x1, y1, x2, y2]. * The boxes are grouped by batches in the first dimension. The sequential * order of the boxes corresponds with input0. For input0 of type * {@link OperandType::TENSOR_QUANT8_ASYMM}, this tensor should be of * {@link OperandType::TENSOR_QUANT16_ASYMM}, with zeroPoint of 0 and - * scale of 0.125. + * scale of 0.125. Zero num_rois is supported for this tensor. * * 2: A 1-D {@link OperandType::TENSOR_INT32} tensor, of shape * [num_rois], specifying the batch index of each box. Boxes with * the same batch index are grouped together. * * 3: An {@link OperandType::FLOAT32} scalar, score_threshold. Boxes * with scores lower than the threshold are filtered before sending * to the NMS algorithm. - * * 4: An {@link OperandType::FLOAT32} scalar, specifying the IoU - * threshold. - * * 5: An {@link OperandType::INT32} scalar, specifying the maximum + * * 4: An {@link OperandType::INT32} scalar, specifying the maximum * number of selected bounding boxes for each image. Set to a negative * value for unlimited number of output bounding boxes. + * * 5: An {@link OperandType::INT32} scalar, specifying the NMS + * kernel method, options are 0:hard, 1:linear, 2:gaussian. + * * 6: An {@link OperandType::FLOAT32} scalar, specifying the IoU + * threshold in hard and linear NMS kernel. This field is ignored if + * gaussian kernel is selected. + * * 7: An {@link OperandType::FLOAT32} scalar, specifying the sigma in + * gaussian NMS kernel. This field is ignored if gaussian kernel is + * not selected. + * * 8: An {@link OperandType::FLOAT32} scalar, nms_score_threshold. + * Boxes with scores lower than the threshold are dropped during the + * score updating phase in soft NMS. * * Outputs: * * 0: A 1-D Tensor of the same {@link OperandType} as input0, with shape @@ -2633,8 +2709,8 @@ enum OperationType : int32_t { * [num_output_rois], specifying the class of each output box. The * sequential order of the boxes corresponds with output0. * * 3: A 1-D {@link OperandType::TENSOR_INT32} tensor, of shape - * [num_rois], specifying the batch index of each box. Boxes with - * the same batch index are grouped together. + * [num_output_rois], specifying the batch index of each box. Boxes + * with the same batch index are grouped together. * * Available since API level 29. */ @@ -2970,8 +3046,8 @@ enum OperationType : int32_t { * For type of {@link OperandType::TENSOR_QUANT16_ASYMM}, the * scale must be 0.125 and the zero point must be 0. * * 2: A 1-D {@link OperandType::TENSOR_INT32} tensor, of shape - * [num_rois], specifying the batch index of each box. Boxes with - * the same batch index are grouped together. + * [num_output_rois], specifying the batch index of each box. Boxes + * with the same batch index are grouped together. * * Available since API level 29. */ @@ -3637,7 +3713,7 @@ enum OperationType : int32_t { * Supported tensor rank: from 1 * * Inputs: - * * 0: A tensor. + * * 0: A tensor, may be zero-sized. * * Outputs: * * 0: The output tensor of same shape as input0, but with @@ -3969,10 +4045,12 @@ enum OperationType : int32_t { * the regions of interest, each line with format [x1, y1, x2, y2]. * For input0 of type {@link OperandType::TENSOR_QUANT8_ASYMM}, * this tensor should be of {@link OperandType::TENSOR_QUANT16_ASYMM}, - * with zeroPoint of 0 and scale of 0.125. + * with zeroPoint of 0 and scale of 0.125. Zero num_rois is + * supported for this tensor. * * 2: An 1-D {@link OperandType::TENSOR_INT32} tensor, of shape * [num_rois], specifying the batch index of each box. Boxes with - * the same batch index are grouped together. + * the same batch index are grouped together. Zero num_rois is + * supported for this tensor. * * 3: An {@link OperandType::INT32} scalar, specifying the output * height of the output tensor. * * 4: An {@link OperandType::INT32} scalar, specifying the output @@ -4137,7 +4215,7 @@ enum OperationType : int32_t { * Supported tensor rank: from 1 * * Inputs: - * * 0: An n-D tensor to take slice from. + * * 0: An n-D tensor to take slice from, may be zero-sized. * * 1: A 1-D tensor of type {@link OperandType::TENSOR_INT32} specifying * the beginning indices of the slice in each dimension. * * 2: A 1-D tensor of type {@link OperandType::TENSOR_INT32} specifying @@ -4551,9 +4629,11 @@ enum OperationType : int32_t { * [batch, height, width, channels]. Alternatively, the data layout could * be NCHW, the data storage order of: [batch, channels, height, width]. * - * Inputs: + * Both resizing by shape and resizing by scale are supported. + * + * Inputs (resizing by shape): * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying - * the input. + * the input. Zero batches is supported for this tensor. * * 1: An {@link OperandType::INT32} scalar, specifying the output * height of the output tensor. * * 2: An {@link OperandType::INT32} scalar, specifying the output @@ -4561,6 +4641,24 @@ enum OperationType : int32_t { * * 3: An {@link OperandType::BOOL} scalar, default to false. * Set to true to specify NCHW data layout for input0 and output0. * + * Inputs (resizing by scale): + * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying + * the input. Zero batches is supported for this tensor. + * * 1: A scalar, specifying height_scale, the scaling factor of the height + * dimension from the input tensor to the output tensor. The output + * height is calculated as new_height = floor(height * height_scale). + * The scalar must be of {@link OperandType::FLOAT16} if input0 is + * of {@link OperandType::TENSOR_FLOAT16} and of + * {@link OperandType::FLOAT32} otherwise. + * * 2: A scalar, specifying width_scale, the scaling factor of the width + * dimension from the input tensor to the output tensor. The output + * width is calculated as new_width = floor(width * width_scale). + * The scalar must be of {@link OperandType::FLOAT16} if input0 is + * of {@link OperandType::TENSOR_FLOAT16} and of + * {@link OperandType::FLOAT32} otherwise. + * * 3: An {@link OperandType::BOOL} scalar, default to false. + * Set to true to specify NCHW data layout for input0 and output0. + * * Outputs: * * 0: The output 4-D tensor, of shape * [batches, new_height, new_width, depth].