From 5f5d5f9a54d4c3f17731acdb4ae02252e9497df0 Mon Sep 17 00:00:00 2001 From: Slava Shklyaev Date: Thu, 11 Apr 2019 16:25:21 +0100 Subject: [PATCH 1/2] Clarify NNAPI documentation for RESHAPE Bug: 117176461 Test: mma Change-Id: I620873536ed99ac79b7eced286a8f2621524290b --- current.txt | 4 ++-- neuralnetworks/1.0/types.hal | 5 +++++ neuralnetworks/1.2/types.hal | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/current.txt b/current.txt index 875be97f28..83a3a10cbb 100644 --- a/current.txt +++ b/current.txt @@ -401,7 +401,7 @@ f7d7cb747dc01a9fdb2d39a80003b4d8df9be733d65f5842198802eb6209db69 android.hardwar 65a021fa89085b62fc96b2b6d3bef2f9103cf4d63379c68bc154fd9eef672852 android.hardware.health@1.0::types b7ecf29927055ec422ec44bf776223f07d79ad9f92ccf9becf167e62c2607e7a android.hardware.keymaster@4.0::IKeymasterDevice 574e8f1499436fb4075894dcae0b36682427956ecb114f17f1fe22d116a83c6b android.hardware.neuralnetworks@1.0::IPreparedModel -417ab60fe1ef786778047e4486f3d868ebce570d91addd8fe4251515213072de android.hardware.neuralnetworks@1.0::types +567de4ebb3a224721eabae40c4484fad2cd1608eb0e66ec9214eb88e9b15d3c9 android.hardware.neuralnetworks@1.0::types ec8aa14fe9b03f2b3fb9845346a4005b6d098ebe2277b2564f73a548a0fd14a7 android.hardware.neuralnetworks@1.1::types 1d4a5776614c08b5d794a5ec5ab04697260cbd4b3441d5935cd53ee71d19da02 android.hardware.radio@1.0::IRadioResponse ed9da80ec0c96991fd03f0a46107815d0e50f764656e49dba4980fa5c31d5bc3 android.hardware.radio@1.0::types @@ -515,7 +515,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 -b75126d572c1788682a679ab53c2dbdf3fcd75f754b1370dbf09aaad0e19d397 android.hardware.neuralnetworks@1.2::types +5c0d2f81f764f6c24928b4bc6b950f58b8eb85e99015bea8510d51e39e8fdadd 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.0/types.hal b/neuralnetworks/1.0/types.hal index 89af35a376..a358946e31 100644 --- a/neuralnetworks/1.0/types.hal +++ b/neuralnetworks/1.0/types.hal @@ -1197,6 +1197,11 @@ enum OperationType : int32_t { * shape of the output tensor. The number of elements implied by shape * must be the same as the number of elements in the input tensor. * + * If one component of shape is the special value -1, the size of that + * dimension is computed so that the total size remains constant. In + * particular, a shape of [-1] flattens into 1-D. At most one component + * of shape can be -1. + * * Outputs: * * 0: The output tensor, of shape specified by the input shape. * diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal index 839114fe7b..f13fcb290b 100644 --- a/neuralnetworks/1.2/types.hal +++ b/neuralnetworks/1.2/types.hal @@ -1548,6 +1548,11 @@ enum OperationType : int32_t { * shape of the output tensor. The number of elements implied by shape * must be the same as the number of elements in the input tensor. * + * If one component of shape is the special value -1, the size of that + * dimension is computed so that the total size remains constant. In + * particular, a shape of [-1] flattens into 1-D. At most one component + * of shape can be -1. + * * Outputs: * * 0: The output tensor, of shape specified by the input shape. * From d6e605985b2ae0f38d10544b5520c6291b7e0bc4 Mon Sep 17 00:00:00 2001 From: Slava Shklyaev Date: Fri, 12 Apr 2019 15:00:48 +0100 Subject: [PATCH 2/2] Clarify NNAPI documentation for MEAN Bug: 113673389 Test: mma Change-Id: Icd1ce2fb9054ab9ac6f660dce84823c73563ddb8 --- current.txt | 4 ++-- neuralnetworks/1.1/types.hal | 13 ++++++++----- neuralnetworks/1.2/types.hal | 13 ++++++++----- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/current.txt b/current.txt index 83a3a10cbb..a9ea1adb80 100644 --- a/current.txt +++ b/current.txt @@ -402,7 +402,7 @@ f7d7cb747dc01a9fdb2d39a80003b4d8df9be733d65f5842198802eb6209db69 android.hardwar b7ecf29927055ec422ec44bf776223f07d79ad9f92ccf9becf167e62c2607e7a android.hardware.keymaster@4.0::IKeymasterDevice 574e8f1499436fb4075894dcae0b36682427956ecb114f17f1fe22d116a83c6b android.hardware.neuralnetworks@1.0::IPreparedModel 567de4ebb3a224721eabae40c4484fad2cd1608eb0e66ec9214eb88e9b15d3c9 android.hardware.neuralnetworks@1.0::types -ec8aa14fe9b03f2b3fb9845346a4005b6d098ebe2277b2564f73a548a0fd14a7 android.hardware.neuralnetworks@1.1::types +d51937a3567a50f239589e40300264c4b57f2c3582c6fc6df082f45eb74d90e3 android.hardware.neuralnetworks@1.1::types 1d4a5776614c08b5d794a5ec5ab04697260cbd4b3441d5935cd53ee71d19da02 android.hardware.radio@1.0::IRadioResponse ed9da80ec0c96991fd03f0a46107815d0e50f764656e49dba4980fa5c31d5bc3 android.hardware.radio@1.0::types 1d19720d4fd38b1095f0f555a4bd92b3b12c9b1d0f560b0e9a474cd6dcc20db6 android.hardware.radio@1.2::IRadio @@ -515,7 +515,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 -5c0d2f81f764f6c24928b4bc6b950f58b8eb85e99015bea8510d51e39e8fdadd android.hardware.neuralnetworks@1.2::types +b47700929d91ad9c037fd26077d4008d4a04753f71f4f332aeedbd1de7bb91e1 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.1/types.hal b/neuralnetworks/1.1/types.hal index 99f873a5ab..335b80366f 100644 --- a/neuralnetworks/1.1/types.hal +++ b/neuralnetworks/1.1/types.hal @@ -104,9 +104,6 @@ enum OperationType : @1.0::OperationType { * in axis. If keep_dims is true, the reduced dimensions are retained with * length 1. * - * If dimensions to reduce have no entries, all dimensions are reduced, and - * a tensor with a single element is returned. - * * Supported tensor {@link OperandType}: * * {@link OperandType::TENSOR_FLOAT32} * * {@link OperandType::TENSOR_QUANT8_ASYMM} @@ -116,8 +113,14 @@ enum OperationType : @1.0::OperationType { * Inputs: * * 0: A tensor, specifying the input. * * 1: A 1-D Tensor of {@link OperandType::TENSOR_INT32}. The dimensions - * to reduce. If None (the default), reduces all dimensions. Must be in - * the range [-rank(input_tensor), rank(input_tensor)). + * to reduce. Must be in the range + * [-rank(input_tensor), rank(input_tensor)). + * + * NOTE: When the operation was introduced, the documentation + * incorrectly stated that if dimensions were empty, the operation + * would reduce across all dimensions. This behavior was never + * implemented. + * * * 2: An {@link OperandType::INT32} scalar, keep_dims. If positive, * retains reduced dimensions with length 1. * diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal index f13fcb290b..499c817348 100644 --- a/neuralnetworks/1.2/types.hal +++ b/neuralnetworks/1.2/types.hal @@ -1954,9 +1954,6 @@ enum OperationType : int32_t { * in axis. If keep_dims is true, the reduced dimensions are retained with * length 1. * - * If dimensions to reduce have no entries, all dimensions are reduced, and - * a tensor with a single element is returned. - * * Supported tensor {@link OperandType}: * * {@link OperandType::TENSOR_FLOAT16} (since API level 29) * * {@link OperandType::TENSOR_FLOAT32} @@ -1967,8 +1964,14 @@ enum OperationType : int32_t { * Inputs: * * 0: A tensor, specifying the input. * * 1: A 1-D Tensor of {@link OperandType::TENSOR_INT32}. The dimensions - * to reduce. If None (the default), reduces all dimensions. Must be in - * the range [-rank(input_tensor), rank(input_tensor)). + * to reduce. Must be in the range + * [-rank(input_tensor), rank(input_tensor)). + * + * NOTE: When the operation was introduced, the documentation + * incorrectly stated that if dimensions were empty, the operation + * would reduce across all dimensions. This behavior was never + * implemented. + * * * 2: An {@link OperandType::INT32} scalar, keep_dims. If positive, * retains reduced dimensions with length 1. *