aboutsummaryrefslogtreecommitdiff
path: root/chapters/ewise_unary.adoc
diff options
context:
space:
mode:
authorEric Kunze <eric.kunze@arm.com>2021-03-08 16:17:26 -0800
committerEric Kunze <eric.kunze@arm.com>2021-03-11 10:20:06 -0800
commit8e4a9d33f0527107fda724fc0f7b6b7c1f42bf79 (patch)
treebdb67b880fcae88f08cf45c27fdd5e572df007d4 /chapters/ewise_unary.adoc
parent1e9ba65f263a15f1f9cf9b9484047ea51237187a (diff)
downloadspecification-8e4a9d33f0527107fda724fc0f7b6b7c1f42bf79.tar.gz
Adjust pseudocode types to account for zero point
When reading tensor values with zero point, the returned value has one more bit than the original to account for zero point. Update cases of apply_clip to properly represent the types involved. Change-Id: I60c17b1b244c34b4f04f042807936ae0f282ce93
Diffstat (limited to 'chapters/ewise_unary.adoc')
-rw-r--r--chapters/ewise_unary.adoc18
1 files changed, 9 insertions, 9 deletions
diff --git a/chapters/ewise_unary.adoc b/chapters/ewise_unary.adoc
index d852fa4..3784274 100644
--- a/chapters/ewise_unary.adoc
+++ b/chapters/ewise_unary.adoc
@@ -262,22 +262,22 @@ Elementwise negation operation
assert(in_t == int8_t || input1_zp == 0) // Zero point only for int8_t
assert(in_t == int8_t || output_zp == 0) // Zero point only for int8_t
for_each(index in shape) {
- in_t value1 = tensor_read<in_t>(input1, shape, index, input1_zp);
- in_t acc = apply_sub<in_t>(0, value1);
- acc = apply_clip<in_t>(acc + output_zp, minimum<in_t>, maximum<in_t>);
- tensor_write<in_t>(output, shape, index, acc);
+ acc_t acc = tensor_read<in_t>(input1, shape, index, input1_zp);
+ acc = apply_sub<acc_t>(0, acc);
+ in_t value = (in_t)apply_clip<acc_t>(acc + output_zp, minimum<in_t>, maximum<in_t>);
+ tensor_write<in_t>(output, shape, index, value);
}
----
*Supported Data Types:*
|===
-|Profile|Mode|in_t
+|Profile|Mode|in_t|acc_t
-|Any|signed 8|int8_t
-|Any|signed 16|int16_t
-|Any|signed 32|int32_t
-|MI, MT|floating-point|float_t
+|Any|signed 8|int8_t|int32_t
+|Any|signed 16|int16_t|int32_t
+|Any|signed 32|int32_t|int32_t
+|MI, MT|floating-point|float_t|float_t
|===
==== RECIPROCAL