diff options
author | Eric Kunze <eric.kunze@arm.com> | 2021-06-17 18:01:09 -0700 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2021-06-24 12:18:14 -0700 |
commit | a9101530d8ea7a3cb470b722bc6cf8745ab283ac (patch) | |
tree | 2918f0c0e16515295ef6d112c279902fdddd44fb /chapters/ewise_binary.adoc | |
parent | f19e594f71e04c72ecf937419333b57dc7dcb873 (diff) | |
download | specification-a9101530d8ea7a3cb470b722bc6cf8745ab283ac.tar.gz |
Replace assert with REQUIRE()
REQUIRE is a direct replacement for the asserts, and uses
the unpredictable() function in pseudocode to describe the required
conditions for operators
Change-Id: I35dc81e083d8e41f16728d992bdb8b06b0271226
Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Diffstat (limited to 'chapters/ewise_binary.adoc')
-rw-r--r-- | chapters/ewise_binary.adoc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/chapters/ewise_binary.adoc b/chapters/ewise_binary.adoc index 45075e9..d94676c 100644 --- a/chapters/ewise_binary.adoc +++ b/chapters/ewise_binary.adoc @@ -71,7 +71,7 @@ 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); - assert(0 <= value2 && value2 <= 31); + REQUIRE(0 <= value2 && value2 <= 31); in_t acc = value1 >> value2; if (round == true && value2 > 0 && (value1 >> (value2 - 1)) & 1 != 0) { acc = acc + 1; @@ -235,8 +235,8 @@ 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); - assert(value2 != 0); - assert((int64_t)value1 / value2 <= maximum<in_t>); + REQUIRE(value2 != 0); + REQUIRE((int64_t)value1 / value2 <= maximum<in_t>); in_t acc = value1 / value2; tensor_write<in_t>(output, shape, index, acc); } @@ -314,7 +314,7 @@ 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); - assert(0 <= value2 && value2 <= 31); + REQUIRE(0 <= value2 && value2 <= 31); in_t acc = value1 << value2; tensor_write<in_t>(output, shape, index, acc); } @@ -354,7 +354,7 @@ 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); - assert(0 <= value2 && value2 <= 31); + REQUIRE(0 <= value2 && value2 <= 31); in_t acc = (unsigned in_t)value1 >> value2; tensor_write<in_t>(output, shape, index, acc); } @@ -540,7 +540,7 @@ Axis of size 1 will be broadcast, as necessary. Rank of input tensors must match [source,c++] ---- -assert(in_t == int32_t || shift == 0); +REQUIRE(in_t == int32_t || shift == 0); for_each(index in shape) { index1 = apply_broadcast(shape, shape1, index); index2 = apply_broadcast(shape, shape2, index); |