diff options
author | Miao Wang <miaowang@google.com> | 2017-09-28 14:41:37 -0700 |
---|---|---|
committer | Miao Wang <miaowang@google.com> | 2017-09-29 11:33:12 -0700 |
commit | 25f0f2dcd7049cd9f8a60133697dff114bbbf00e (patch) | |
tree | a5a959e44165267a7afc4671201f2ec3473760f1 /nn/runtime/include/NeuralNetworks.h | |
parent | f38818fb527204ca428ac5a43f4be35c48e5578e (diff) | |
download | ml-25f0f2dcd7049cd9f8a60133697dff114bbbf00e.tar.gz |
Allow ADD and MUL taking quantized input.
- Implement the quant8 path for ADD and MUL.
- Add tests for quant8 ADD and MUL, both normal and broadcast version.
- Add validation for quantization parameters, forcing scale >= 0 and
zeroPoint in range [0, 255] for QUANT8_ASYMM type operands.
Bug: 63905942
Test: mm
Test: NeuralNetworksTest pass
Change-Id: Ib643217737af9624a079369e0aea792025223fbb
Diffstat (limited to 'nn/runtime/include/NeuralNetworks.h')
-rw-r--r-- | nn/runtime/include/NeuralNetworks.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nn/runtime/include/NeuralNetworks.h b/nn/runtime/include/NeuralNetworks.h index 1c456164c..c0fc5cfc0 100644 --- a/nn/runtime/include/NeuralNetworks.h +++ b/nn/runtime/include/NeuralNetworks.h @@ -80,8 +80,8 @@ typedef enum { * * Attached to this tensor are two numbers that can be used to convert * the 8 bit integer to the real value and vice versa. These two numbers are: - * - scale: a 32 bit floating point value - * - zeroPoint: an 32 bit integer + * - scale: a 32 bit non-negative floating point value. + * - zeroPoint: an 32 bit integer, in range [0, 255]. * * The formula is: * real_value = (integer_value - zeroPoint) * scale. @@ -115,6 +115,7 @@ typedef enum { * * Supported tensor types: * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} * * Supported tensor rank: up to 4 * @@ -713,6 +714,7 @@ typedef enum { * * Supported tensor types: * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} * * Supported tensor rank: up to 4 * @@ -724,6 +726,8 @@ typedef enum { * * Outputs: * * 0: The product, a tensor of the same type as input0. + * For output tensor of {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} type, the following + * condition must be satisfied: output_scale > input1_scale * input2_scale. */ ANEURALNETWORKS_MUL = 18, |