aboutsummaryrefslogtreecommitdiff
path: root/chapters/ewise_binary.adoc
diff options
context:
space:
mode:
authorEric Kunze <eric.kunze@arm.com>2021-08-17 15:20:06 -0700
committerEric Kunze <eric.kunze@arm.com>2021-08-23 16:26:33 -0700
commit8f57f9e092836a584d7b007b926a31fe2bc80b8a (patch)
treef2b8e7d21e022a3e089eae0d98e925707f90aaeb /chapters/ewise_binary.adoc
parentca2a854e3d46f91ecaa446d4b2311112cc2326fd (diff)
downloadspecification-8f57f9e092836a584d7b007b926a31fe2bc80b8a.tar.gz
Fix pooling argument tables
Make the input tensor shape dimensions correct for the pseudocode. Clarify the count used for average pooling only includes valid elements. Remove stale reference to PLACEHOLDER nodes. Change-Id: Ia0b9f0aa404008c6a36671da12188cb0999712d4 Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Diffstat (limited to 'chapters/ewise_binary.adoc')
-rw-r--r--chapters/ewise_binary.adoc9
1 files changed, 7 insertions, 2 deletions
diff --git a/chapters/ewise_binary.adoc b/chapters/ewise_binary.adoc
index 2b1eadd..1a54a99 100644
--- a/chapters/ewise_binary.adoc
+++ b/chapters/ewise_binary.adoc
@@ -58,7 +58,7 @@ Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match
|Input|in_t*|input1|shape1|Input tensor
|Input|in_t*|input2|shape2|Input tensor with the same rank as input1
-|Input|bool_t |round |- | If true then the shift is rounded
+|Input|bool_t|round|-|If true then the shift is rounded
|Output|in_t*|output|shape|Output tensor with broadcast shape if necessary
|===
@@ -71,7 +71,12 @@ for_each(index in shape) {
index2 = apply_broadcast(shape, shape2, index);
in_t value1 = tensor_read<in_t>(input1, shape1, index1);
in_t value2 = tensor_read<in_t>(input2, shape2, index2);
- REQUIRE(0 <= value2 && value2 <= 31);
+
+ // Ensure that shift amount is appropriate for the data type
+ REQUIRE((in_t == int32_t && 0 <= value2 && value2 <= 31) ||
+ (in_t == int16_t && 0 <= value2 && value2 <= 15) ||
+ (in_t == int8_t && 0 <= value2 && value2 <= 7));
+
in_t acc = value1 >> value2;
if (round == true && value2 > 0 && (value1 >> (value2 - 1)) & 1 != 0) {
acc = acc + 1;