From 077c0339d4fdf289794ee9c401f490e8793d46ca Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Wed, 25 Mar 2020 16:45:04 -0700 Subject: [PATCH] Update the specification for the following operations - RANDOM_MULTINOMIAL - L2_NORMALIZATION Bug: 136279892 Bug: 140177375 Test: mm Change-Id: Iab38ef29ebf6d1f5c0a408436b3d564e45e537a0 --- current.txt | 6 +++--- neuralnetworks/1.0/types.hal | 10 +++++----- neuralnetworks/1.2/types.hal | 8 ++++---- neuralnetworks/1.3/types.hal | 12 ++++++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/current.txt b/current.txt index 9c0a77695d..b8196a218a 100644 --- a/current.txt +++ b/current.txt @@ -594,11 +594,11 @@ bceee81ec1b59324abd05932b5620fda5a6589597c9cb3953ba7f3ea02cccd3e android.hardwar 2ce820dc4f3c6d85721b65150ed2157c6e2e2055f866fb6c6ba4790f14408d66 android.hardware.camera.provider@2.4::ICameraProviderCallback b69a7615c508acf5c5201efd1bfa3262167874fc3594e2db5a3ff93addd8ac75 android.hardware.keymaster@4.0::IKeymasterDevice eb2fa0c883c2185d514be0b84c179b283753ef0c1b77b45b4f359bd23bba8b75 android.hardware.neuralnetworks@1.0::IPreparedModel -8eac60e1f724d141c71c69f06d4544acb720a55dfbbcd97fa01bb3d25ee4e2f5 android.hardware.neuralnetworks@1.0::types +92e101b30e47bdf526a01c52cecfbe730def5997b8260ab497eb949eb2a6dcdf android.hardware.neuralnetworks@1.0::types 5f6d3097ba84cb63c430787123f4de1b31c11f90b531b98eae9a8623a5ae962a android.hardware.neuralnetworks@1.1::types fb382e986c10b8fbb797a8546e8f9ea6d1107bfe6f3fb7e57f6bbbf1f807a906 android.hardware.neuralnetworks@1.2::IDevice 40e71cd693de5b832325c5d8f081f2ff20a7ba2b89d401cee5b4b3eb0e241681 android.hardware.neuralnetworks@1.2::IPreparedModel -00649d29680f2c47edf60000c3ae7ae906ba638f0616947147e3676a83cf36fa android.hardware.neuralnetworks@1.2::types +ee1a0dee5be00a6fe2d4d3270068c78016dcb194d768fe07ed894ea20904037f android.hardware.neuralnetworks@1.2::types a785a57447a81e9c130eef6904c3a5c256076c6a04588c40620ebd6fa2660d77 android.hardware.radio@1.2::types 1a6e2bd289f22931c526b21916910f1d4c436b7acb9556e4243de4ce8e6cc2e4 android.hardware.soundtrigger@2.0::ISoundTriggerHwCallback fd65298e1e09e0e3c781ab18305920d757dbe55a3b459ce17814ec5cf6dfee99 android.hardware.wifi@1.0::IWifiP2pIface @@ -676,7 +676,7 @@ a3eddd9bbdc87e8c22764070037dd1154f1cf006e6fba93364c4f85d4c134a19 android.hardwar 6e904be0ddca5ae1de8eba020e6c38ed935ea7d80cd08f47787f137a0ca58555 android.hardware.neuralnetworks@1.3::IFencedExecutionCallback 2b0b10d2ea7a18a4048cd0eb83d35c19a817aeee95f65807fc31f4ef21381397 android.hardware.neuralnetworks@1.3::IPreparedModel eee3430cc86c97c7b407495863d8fb61da6f1a64b7721e77b9b4909b11b174e9 android.hardware.neuralnetworks@1.3::IPreparedModelCallback -e442ab1b440327fe4e8a3b0b8ac6874e9bc6342e91fe976eb9fea77c63961ec8 android.hardware.neuralnetworks@1.3::types +acf84925f8ee0a651f2ec547ac334034de266479b93af5434f6c1f25e66aba96 android.hardware.neuralnetworks@1.3::types b454df853441c12f6e425e8a60dd29fda20f5e6e39b93d1103e4b37495db38aa android.hardware.radio@1.5::IRadio fcbb0742a88215ee7a6d7ce0825d253eb2b50391fc6c8c48667f9fd7f6d4549e android.hardware.radio@1.5::IRadioIndication b809193970a91ca637a4b0184767315601d32e3ef3d5992ffbc7a8d14a14f015 android.hardware.radio@1.5::IRadioResponse diff --git a/neuralnetworks/1.0/types.hal b/neuralnetworks/1.0/types.hal index 1175a309dd..620eefb48b 100644 --- a/neuralnetworks/1.0/types.hal +++ b/neuralnetworks/1.0/types.hal @@ -261,7 +261,7 @@ enum OperationType : int32_t { * filter. * * 2: A 1-D tensor, of shape [depth_out], specifying the bias. For input * tensor of type {@link OperandType::TENSOR_FLOAT32} - * the bias must be of the same type. + * the bias must be of the same type. * For filter tensor of {@link OperandType::TENSOR_QUANT8_ASYMM}, * the bias should be of {@link OperandType::TENSOR_INT32}, with zeroPoint * of 0 and bias_scale == input_scale * filter_scale. @@ -289,7 +289,7 @@ enum OperationType : int32_t { * filter. * * 2: A 1-D tensor, of shape [depth_out], specifying the bias. For input * tensor of type {@link OperandType::TENSOR_FLOAT32} - * the bias must be of the same + * the bias must be of the same * type. * For filter tensor of {@link OperandType::TENSOR_QUANT8_ASYMM}, * the bias should be of {@link OperandType::TENSOR_INT32}, with zeroPoint @@ -356,7 +356,7 @@ enum OperationType : int32_t { * specifying the filter. * * 2: A 1-D tensor, of shape [depth_out], specifying the bias. For input * tensor of type {@link OperandType::TENSOR_FLOAT32} - * the bias must be of the same type. + * the bias must be of the same type. * For filter tensor of {@link OperandType::TENSOR_QUANT8_ASYMM}, * the bias should be of {@link OperandType::TENSOR_INT32}, with zeroPoint * of 0 and bias_scale == input_scale * filter_scale. @@ -385,7 +385,7 @@ enum OperationType : int32_t { * specifying the filter. * * 2: A 1-D tensor, of shape [depth_out], specifying the bias. For input * tensor of type {@link OperandType::TENSOR_FLOAT32} - * the bias must be of the same type. + * the bias must be of the same type. * For filter tensor of {@link OperandType::TENSOR_QUANT8_ASYMM}, * the bias should be of {@link OperandType::TENSOR_INT32}, with zeroPoint * of 0 and bias_scale == input_scale * filter_scale. @@ -628,7 +628,7 @@ enum OperationType : int32_t { HASHTABLE_LOOKUP = 10, /** - * Applies L2 normalization along the depth dimension. + * Applies L2 normalization along the axis dimension. * * The values in the output tensor are computed as: * diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal index f0fd7690ba..2c3c599eef 100644 --- a/neuralnetworks/1.2/types.hal +++ b/neuralnetworks/1.2/types.hal @@ -846,7 +846,7 @@ enum OperationType : int32_t { HASHTABLE_LOOKUP = @1.1::OperationType:HASHTABLE_LOOKUP, /** - * Applies L2 normalization along the depth dimension. + * Applies L2 normalization along the axis dimension. * * The values in the output tensor are computed as: * @@ -854,8 +854,7 @@ enum OperationType : int32_t { * input[batch, row, col, channel] / * sqrt(sum_{c} pow(input[batch, row, col, c], 2)) * - * For input tensor with rank less than 4, independently normalizes each - * 1-D slice along dimension dim. + * By default the axis dimension is the last dimension of the input tensor. * * Supported tensor {@link OperandType}: * * {@link OperandType::TENSOR_FLOAT16} (since HAL version 1.2) @@ -3843,7 +3842,8 @@ enum OperationType : int32_t { * * 1: A scalar {@link OperandType::INT32}, specifying the number of * independent samples to draw for each row slice. * * 2: A 1-D {@link OperandType::TENSOR_INT32} tensor with shape [2], - * specifying seeds used to initialize the random distribution. + * specifying seeds used to initialize the random distribution. If both + * provided seeds are 0, both will be randomly generated. * Outputs: * * 0: A 2-D {@link OperandType::TENSOR_INT32} tensor with shape * [batches, samples], containing the drawn samples. diff --git a/neuralnetworks/1.3/types.hal b/neuralnetworks/1.3/types.hal index 25ec915a8a..56930c2445 100644 --- a/neuralnetworks/1.3/types.hal +++ b/neuralnetworks/1.3/types.hal @@ -833,7 +833,7 @@ enum OperationType : int32_t { HASHTABLE_LOOKUP = @1.2::OperationType:HASHTABLE_LOOKUP, /** - * Applies L2 normalization along the depth dimension. + * Applies L2 normalization along the axis dimension. * * The values in the output tensor are computed as: * @@ -841,8 +841,7 @@ enum OperationType : int32_t { * input[batch, row, col, channel] / * sqrt(sum_{c} pow(input[batch, row, col, c], 2)) * - * For input tensor with rank less than 4, independently normalizes each - * 1-D slice along dimension dim. + * By default the axis dimension is the last dimension of the input tensor. * * Supported tensor {@link OperandType}: * * {@link OperandType::TENSOR_FLOAT16} (since HAL version 1.2) @@ -867,6 +866,10 @@ enum OperationType : int32_t { * the scale must be 1.f / 128 and the zeroPoint must be 128. * For {@link OperandType::TENSOR_QUANT8_ASYMM_SIGNED}, * the scale must be 1.f / 128 and the zeroPoint must be 0. + * + * NOTE: Before HAL version 1.3, if the elements along an axis are all zeros, + * the result is undefined. Since HAL version 1.3, if the elements along an axis + * are all zeros, the result is logical zero. */ L2_NORMALIZATION = @1.2::OperationType:L2_NORMALIZATION, @@ -4063,7 +4066,8 @@ enum OperationType : int32_t { * * 1: A scalar {@link OperandType::INT32}, specifying the number of * independent samples to draw for each row slice. * * 2: A 1-D {@link OperandType::TENSOR_INT32} tensor with shape [2], - * specifying seeds used to initialize the random distribution. + * specifying seeds used to initialize the random distribution. If both + * provided seeds are 0, both will be randomly generated. * Outputs: * * 0: A 2-D {@link OperandType::TENSOR_INT32} tensor with shape * [batches, samples], containing the drawn samples.