From b9319bd3bf64e4a643045ad0493bedce60786474 Mon Sep 17 00:00:00 2001 From: Xusong Wang Date: Thu, 7 Feb 2019 12:28:35 -0800 Subject: [PATCH] Modify several 1.2 nn operation specs. - Add TENSOR_QUANT8_ASYMM to RESIZE_BILINEAR - Change the spec of batch_split in * GENERATE_PROPOSALS * ROI_ALIGN * ROI_POOLING * AXIS_ALIGNED_BBOX_TRANSFORM * BOX_WITH_NMS_LIMIT - Add new op RESIZE_NEAREST_NEIGHBOR - Fix minor specification error in * AXIS_ALIGNED_BBOX_TRANSFORM * GENERATE_PROPOSALS Bug: 124060811 Bug: 124061329 Bug: 124061327 Test: 1.2 VTS tests with sample driver Change-Id: If8b8cabd249f17247d8a5278b8360685c97c68e6 --- current.txt | 2 +- neuralnetworks/1.2/types.hal | 65 +++++++++++++++++++++++++++++++----- 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/current.txt b/current.txt index 0b58830075..82092993a2 100644 --- a/current.txt +++ b/current.txt @@ -421,7 +421,7 @@ dd1ec219f5d2e2b33c6c0bcb92e63bbedb36f7c716413462848f6b6ae74fc864 android.hardwar 92714960d1a53fc2ec557302b41c7cc93d2636d8364a44bd0f85be0c92927ff8 android.hardware.neuralnetworks@1.2::IExecutionCallback 83885d366f22ada42c00d8854f0b7e7ba4cf73ddf80bb0d8e168ce132cec57ea android.hardware.neuralnetworks@1.2::IPreparedModel e1c734d1545e1a4ae749ff1dd9704a8e594c59aea7c8363159dc258e93e0df3b android.hardware.neuralnetworks@1.2::IPreparedModelCallback -a42fb6a33e242e0035de32cdcd4b743d46ae93d65a1e316f3bffe7218ade82cb android.hardware.neuralnetworks@1.2::types +313b341f1f6196a48cf304eaf067f67510c1ebc04df8c7cd536db5611df5c5c2 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 3bddbe8208..06bdc6adf4 100644 --- a/neuralnetworks/1.2/types.hal +++ b/neuralnetworks/1.2/types.hal @@ -1528,6 +1528,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: 4, with "NHWC" or "NCHW" data layout. * With the default data layout NHWC, the data is stored in the order of: @@ -2212,6 +2213,7 @@ enum OperationType : int32_t { * Supported tensor {@link OperandType}: * * {@link OperandType::TENSOR_FLOAT16} * * {@link OperandType::TENSOR_FLOAT32} + * * {@link OperandType::TENSOR_QUANT16_ASYMM} * * Inputs: * * 0: A 2-D Tensor of shape [num_rois, 4], specifying the locations of the @@ -2228,7 +2230,8 @@ enum OperationType : int32_t { * {@link OperandType::TENSOR_QUANT16_ASYMM}, this tensor should be * of {@link OperandType::TENSOR_QUANT8_ASYMM}. * * 2: An 1-D {@link OperandType::TENSOR_INT32} tensor, of shape - * [batches], specifying the number of output boxes for each batch. + * [num_rois], specifying the batch index of each box. Boxes with + * the same batch index are grouped together. * * 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]. @@ -2557,8 +2560,9 @@ enum OperationType : int32_t { * {@link OperandType::TENSOR_QUANT8_ASYMM}, this tensor should be of * {@link OperandType::TENSOR_QUANT16_ASYMM}, with zeroPoint of 0 and * scale of 0.125. - * * 2: A 1-D Tensor of shape [batches], specifying the number of boxes - * for each image in the batch. + * * 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. @@ -2584,7 +2588,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 - * [batches], specifying the number of output boxes for each image. + * [num_rois], specifying the batch index of each box. Boxes with + * the same batch index are grouped together. * * Available since API level 29. */ @@ -2878,6 +2883,9 @@ enum OperationType : int32_t { * {@link OperandType::TENSOR_QUANT16_SYMM}, with scale of 0.125. * * 3: A 2-D Tensor of shape [batches, 2], specifying the size of * each image in the batch, with format [image_height, image_width]. + * For input0 of type {@link OperandType::TENSOR_QUANT8_ASYMM}, this + * tensor should be of {@link OperandType::TENSOR_QUANT16_SYMM}, with + * scale of 0.125. * * 4: An {@link OperandType::FLOAT32} scalar, specifying the ratio * from the height of original image to the height of feature map. * * 5: An {@link OperandType::FLOAT32} scalar, specifying the ratio @@ -2904,14 +2912,15 @@ enum OperationType : int32_t { * each batch is not guaranteed. For type of * {@link OperandType::TENSOR_QUANT8_ASYMM}, the scale and zero * point must be the same as input0. - * * 1: A tensor of the same {@link OperandType} as input1, of shape + * * 1: A tensor of the same {@link OperandType} as input3, of shape * [num_output_rois, 4], specifying the coordinates of each output * bounding box for each class, with format [x1, y1, x2, y2]. * The sequential order of the boxes corresponds with output0. * 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 - * [batches], specifying the number of output boxes for each image. + * [num_rois], specifying the batch index of each box. Boxes with + * the same batch index are grouped together. * * Available since API level 29. */ @@ -3904,7 +3913,8 @@ enum OperationType : int32_t { * this tensor should be of {@link OperandType::TENSOR_QUANT16_ASYMM}, * with zeroPoint of 0 and scale of 0.125. * * 2: An 1-D {@link OperandType::TENSOR_INT32} tensor, of shape - * [batches], specifying the number of output boxes for each batch. + * [num_rois], specifying the batch index of each box. Boxes with + * the same batch index are grouped together. * * 3: An {@link OperandType::INT32} scalar, specifying the output * height of the output tensor. * * 4: An {@link OperandType::INT32} scalar, specifying the output @@ -3960,7 +3970,8 @@ enum OperationType : int32_t { * this tensor should be of {@link OperandType::TENSOR_QUANT16_ASYMM}, * with zeroPoint of 0 and scale of 0.125. * * 2: An 1-D {@link OperandType::TENSOR_INT32} tensor, of shape - * [batches], specifying the number of output boxes for each batch. + * [num_rois], specifying the batch index of each box. Boxes with + * the same batch index are grouped together. * * 3: An {@link OperandType::INT32} scalar, specifying the output * height of the output tensor. * * 4: An {@link OperandType::INT32} scalar, specifying the output @@ -4441,6 +4452,42 @@ enum OperationType : int32_t { * Available since API level 29. */ UNIDIRECTIONAL_SEQUENCE_RNN = 93, + + /** + * Resizes images to given size using the nearest neighbor interpretation. + * + * Resized images must be distorted if their output aspect ratio is not the + * same as input aspect ratio. The corner pixels of output may not be the + * same as corner pixels of input. + * + * Supported tensor {@link OperandType}: + * * {@link OperandType::TENSOR_FLOAT16} + * * {@link OperandType::TENSOR_FLOAT32} + * * {@link OperandType::TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: 4, with "NHWC" or "NCHW" data layout. + * With the default data layout NHWC, the data is stored in the order of: + * [batch, height, width, channels]. Alternatively, the data layout could + * be NCHW, the data storage order of: [batch, channels, height, width]. + * + * Inputs: + * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying + * the input. + * * 1: An {@link OperandType::INT32} scalar, specifying the output + * height of the output tensor. + * * 2: An {@link OperandType::INT32} scalar, specifying the output + * width of the output tensor. + * * 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]. + * + * Available since API level 29. + */ + RESIZE_NEAREST_NEIGHBOR = 94, + /** * DEPRECATED. Since NNAPI 1.2, extensions are the preferred alternative to * OEM operation and data types. @@ -4463,7 +4510,7 @@ enum OperationType : int32_t { enum OperationTypeRange : uint32_t { BASE_MIN = 0, FUNDAMENTAL_MIN = 0, - FUNDAMENTAL_MAX = 93, + FUNDAMENTAL_MAX = 94, OEM_MIN = 10000, OEM_MAX = 10000, BASE_MAX = 0xFFFF,