aboutsummaryrefslogtreecommitdiff
path: root/chapters/type_conversion.adoc
diff options
context:
space:
mode:
authorDominic Symes <dominic.symes@arm.com>2021-03-19 13:56:27 +0000
committerDominic Symes <dominic.symes@arm.com>2021-07-13 09:51:07 +0100
commitca2a854e3d46f91ecaa446d4b2311112cc2326fd (patch)
tree23fc1bb30c333a28d4a743a4a05059b79cf7b826 /chapters/type_conversion.adoc
parenta9101530d8ea7a3cb470b722bc6cf8745ab283ac (diff)
downloadspecification-ca2a854e3d46f91ecaa446d4b2311112cc2326fd.tar.gz
Add definition of TOSA compliance
Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: I2e25d0467843adb078d5ab9fd681af40b2ffa52e
Diffstat (limited to 'chapters/type_conversion.adoc')
-rw-r--r--chapters/type_conversion.adoc9
1 files changed, 5 insertions, 4 deletions
diff --git a/chapters/type_conversion.adoc b/chapters/type_conversion.adoc
index 35cebe7..b4d372d 100644
--- a/chapters/type_conversion.adoc
+++ b/chapters/type_conversion.adoc
@@ -93,7 +93,7 @@ Rescale quantized values into a new domain. This function scales by factor: mult
|Attribute|out_t|output_zp|-|Output tensor zero point
|Input (MT profile) Attribute (BI/MI profiles)|mul_t|multiplier[NC]|-|Scaling multiplier array
|Input (MT profile) Attribute (BI/MI profiles)|uint6_t|shift[NC] |-|Scaling shift array
-|Input (MT profile) Attribute (BI/MI profiles)|bool_t|scale32|-|if (scale32) mul_t=int32_t else mul_t=int16_t
+|Attribute|bool_t|scale32|-|if (scale32) mul_t=int32_t else mul_t=int16_t
|Attribute|bool_t|double_round|-|Select double round mode
|Attribute|bool_t|per_channel|-|if (per_channel) NC=shape[dims-1] else NC=1
|===
@@ -103,9 +103,10 @@ Rescale quantized values into a new domain. This function scales by factor: mult
[source,c++]
----
for_each(index in shape) {
- REQUIRE(in_t == int8_t || in_t == uint8_t || input_zp == 0);
- REQUIRE(out_t == int8_t || out_t == uint8_t || output_zp == 0);
- REQUIRE((scale32 && in_t != int48_t_t) || (!scale32 && !double_round));
+ ERROR_IF(in_t != int8_t && in_t != uint8_t && input_zp != 0);
+ ERROR_IF(out_t != int8_t && out_t != uint8_t && output_zp != 0);
+ ERROR_IF(scale32 && int_t == int48_t);
+ ERROR_IF(!scale32 && double_round);
int48_t value = tensor_read<in_t>(input, shape, index, input_zp);
int c = (per_channel) ? index[dims-1] : 0;
int32_t result = (scale32) ?