diff options
author | Eric Kunze <eric.kunze@arm.com> | 2021-10-25 16:04:20 -0700 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2021-10-28 09:57:46 -0700 |
commit | 3170439f3938d007e58998d61eed98560c3f026c (patch) | |
tree | 6f4abac7c7c037b749c6801e95259fdd14cfd341 /chapters/ewise_unary.adoc | |
parent | 82019a2621edf481e12b5de09dbfe5dc56283150 (diff) | |
download | specification-3170439f3938d007e58998d61eed98560c3f026c.tar.gz |
Remove zp subtraction from tensor_read pseudocode
Operators which use the zero-point functionalty for 8-bit integer
processing are updated to do the zero-point subtract in their
pseudocode.
Note that the PAD operator no longer takes a zero point argument,
and instead requires callers to account for the zero point in the
pad_const argument.
Change-Id: I3bca1cae85aa2093000c420f0433633c347a29de
Diffstat (limited to 'chapters/ewise_unary.adoc')
-rw-r--r-- | chapters/ewise_unary.adoc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/chapters/ewise_unary.adoc b/chapters/ewise_unary.adoc index 2dc01df..e2b754a 100644 --- a/chapters/ewise_unary.adoc +++ b/chapters/ewise_unary.adoc @@ -247,10 +247,11 @@ Elementwise negation operation ERROR_IF(in_t != int8_t && input1_zp != 0) // Zero point only for int8_t ERROR_IF(in_t != int8_t && output_zp != 0) // Zero point only for int8_t for_each(index in shape) { - 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); + in_t value1 = tensor_read<in_t>(input1, shape, index); + acc_t value = (acc_t)value1 - input1_zp; + value = apply_sub<acc_t>(0, value); + in_t result = (in_t)apply_clip<acc_t>(value + output_zp, minimum<in_t>, maximum<in_t>); + tensor_write<in_t>(output, shape, index, result); } ---- |