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/reduction.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/reduction.adoc')
-rw-r--r-- | chapters/reduction.adoc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/chapters/reduction.adoc b/chapters/reduction.adoc index b84b7f0..391591f 100644 --- a/chapters/reduction.adoc +++ b/chapters/reduction.adoc @@ -27,8 +27,8 @@ Reduce a tensor along the given axis with a logical AND operation [source,c] ---- -assert(0 <= axis && axis < rank(shape1)); -assert(shape[axis] == 1); +REQUIRE(0 <= axis && axis < rank(shape1)); +REQUIRE(shape[axis] == 1); for_each(index in shape) { tensor_write<in_t>(output, shape, index, true); } @@ -68,8 +68,8 @@ Reduce a tensor along the given axis with a logical OR operation [source,c] ---- -assert(0 <= axis && axis < rank(shape1)); -assert(shape[axis] == 1); +REQUIRE(0 <= axis && axis < rank(shape1)); +REQUIRE(shape[axis] == 1); for_each(index in shape) { tensor_write<in_t>(output, shape, index, false); } @@ -109,8 +109,8 @@ Reduce a tensor along the given axis with a maximum operation [source,c] ---- -assert(0 <= axis && axis < rank(shape1)); -assert(shape[axis] == 1); +REQUIRE(0 <= axis && axis < rank(shape1)); +REQUIRE(shape[axis] == 1); for_each(index in shape) { tensor_write<in_t>(output, shape, index, minimum<in_t>); } @@ -156,8 +156,8 @@ Quantization is ignored when doing the REDUCE_MIN operation. The input and outpu [source,c] ---- -assert(0 <= axis && axis < rank(shape1)); -assert(shape[axis]==1); +REQUIRE(0 <= axis && axis < rank(shape1)); +REQUIRE(shape[axis]==1); for_each(index in shape) { tensor_write<in_t>(output, shape, index, maximum<in_t>); } @@ -200,8 +200,8 @@ Reduce a tensor along the given axis by computing the product of the axis. [source,c] ---- -assert(0 <= axis && axis < rank(shape1)); -assert(shape[axis] == 1); +REQUIRE(0 <= axis && axis < rank(shape1)); +REQUIRE(shape[axis] == 1); for_each(index in shape) { tensor_write<in_t>(output, shape, index, 1.0); } @@ -241,8 +241,8 @@ Reduce a tensor along the given axis by computing the sum of the axis. [source,c] ---- -assert(0 <= axis && axis < rank(shape1)); -assert(shape[axis] == 1); +REQUIRE(0 <= axis && axis < rank(shape1)); +REQUIRE(shape[axis] == 1); for_each(index in shape) { tensor_write<in_t>(output, shape, index, 0); } |