diff options
author | Eric Kunze <eric.kunze@arm.com> | 2021-08-17 14:57:46 -0700 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2021-09-16 10:59:28 -0700 |
commit | 173fc16f46b2938ff49a39fb2dad31c54161a874 (patch) | |
tree | 0e17d2d391353fab462fa78e854538a9f2e4a629 /chapters/ewise_binary.adoc | |
parent | 32de3912884dc2dc1425b61c419bbd30f2adbbbd (diff) | |
download | specification-173fc16f46b2938ff49a39fb2dad31c54161a874.tar.gz |
Clarify range limitations for tensors
Catch zero and negative sized tensors.
Clarify configuration of bool_t in the reference model.
int4_t limitations on -8 to stay symmetric around 0.
Pad values must be >= 0.
Stride,dilation values must be >= 1.
Change-Id: Idb6ef740f855912a8340475ba319816f90c9b051
Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Diffstat (limited to 'chapters/ewise_binary.adoc')
-rw-r--r-- | chapters/ewise_binary.adoc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/chapters/ewise_binary.adoc b/chapters/ewise_binary.adoc index 1a54a99..9265c47 100644 --- a/chapters/ewise_binary.adoc +++ b/chapters/ewise_binary.adoc @@ -241,6 +241,8 @@ for_each(index in shape) { in_t value1 = tensor_read<in_t>(input1, shape1, index1); in_t value2 = tensor_read<in_t>(input2, shape2, index2); REQUIRE(value2 != 0); + // This catches the case where we divide minimum<in_t> by -1 + // which is not representable in two's complement REQUIRE((int64_t)value1 / value2 <= maximum<in_t>); in_t acc = value1 / value2; tensor_write<in_t>(output, shape, index, acc); @@ -668,10 +670,12 @@ None [source,c++] ---- +REQUIRE(length(table) == TABLE_SIZE); for_each(index in shape) { in_t value = tensor_read<in_t>(input, shape, index); if (in_t == int8_t) { - out_t acc = table[value]; + // value is a signed int, convert to a 0 based index + out_t acc = table[value + 128]; } else { out_t acc = apply_lookup(table, value); } |