summaryrefslogtreecommitdiff
path: root/nn
diff options
context:
space:
mode:
authorSlava Shklyaev <slavash@google.com>2020-07-09 13:50:20 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-07-09 13:50:20 +0000
commit5d8e64ad8936c79bf07c2a061bc027091a4ac5e1 (patch)
treee670787d3ce5016bef9198ab79a97a25a0620403 /nn
parent591bbb5c09b097a71a0dc595f7a096ee5080711c (diff)
parentba32519aa6f884dc793b56adcdd1415dc4ca5075 (diff)
downloadml-5d8e64ad8936c79bf07c2a061bc027091a4ac5e1.tar.gz
Update scale and zeroPoint documentation am: c637d99357 am: ba32519aa6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/ml/+/12070382 Change-Id: I0745e23e932dd0b3d923490599e1ebc45a150705
Diffstat (limited to 'nn')
-rw-r--r--nn/runtime/include/NeuralNetworks.h16
-rw-r--r--nn/tools/api/NeuralNetworks.t16
2 files changed, 26 insertions, 6 deletions
diff --git a/nn/runtime/include/NeuralNetworks.h b/nn/runtime/include/NeuralNetworks.h
index 2f7d3b38e..1eb2f5466 100644
--- a/nn/runtime/include/NeuralNetworks.h
+++ b/nn/runtime/include/NeuralNetworks.h
@@ -6230,11 +6230,21 @@ typedef struct ANeuralNetworksOperandType {
const uint32_t* dimensions;
/**
- * These two fields are only used for quantized tensors.
- * They must be zero for all other types.
- * The dequantized value of each entry is (value - zeroPoint) * scale.
+ * The quantization scale.
+ *
+ * Must be 0 when not applicable to an operand type.
+ *
+ * See {@link OperandCode}.
*/
float scale;
+
+ /**
+ * The quantization zero point.
+ *
+ * Must be 0 when not applicable to an operand type.
+ *
+ * See {@link OperandCode}.
+ */
int32_t zeroPoint;
} ANeuralNetworksOperandType;
diff --git a/nn/tools/api/NeuralNetworks.t b/nn/tools/api/NeuralNetworks.t
index a6ab569cd..d7cf8b2d0 100644
--- a/nn/tools/api/NeuralNetworks.t
+++ b/nn/tools/api/NeuralNetworks.t
@@ -656,11 +656,21 @@ typedef struct ANeuralNetworksOperandType {
const uint32_t* dimensions;
/**
- * These two fields are only used for quantized tensors.
- * They must be zero for all other types.
- * The dequantized value of each entry is (value - zeroPoint) * scale.
+ * The quantization scale.
+ *
+ * Must be 0 when not applicable to an operand type.
+ *
+ * See {@link OperandCode}.
*/
float scale;
+
+ /**
+ * The quantization zero point.
+ *
+ * Must be 0 when not applicable to an operand type.
+ *
+ * See {@link OperandCode}.
+ */
int32_t zeroPoint;
} ANeuralNetworksOperandType;