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/image.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/image.adoc')
-rw-r--r-- | chapters/image.adoc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/chapters/image.adoc b/chapters/image.adoc index 3bf4109..e098bac 100644 --- a/chapters/image.adoc +++ b/chapters/image.adoc @@ -1,7 +1,7 @@ // // This confidential and proprietary software may be used only as // authorised by a licensing agreement from ARM Limited -// (C) COPYRIGHT 2020 ARM Limited +// (C) COPYRIGHT 2020-2021 ARM Limited // ALL RIGHTS RESERVED // The entire notice above must be reproduced on all authorised // copies and copies may only be made to the extent permitted @@ -55,21 +55,21 @@ None ---- // Ensure image size is supported by GPU APIs and that for integer // implementations, position * stride does not overflow int32_t. -assert(max(OH,OW,IH,IW) < 16384); +REQUIRE(max(OH,OW,IH,IW) < 16384); if (resize_t == float_t) { // The shift attribute is not used for floating point - assert(shift == 0); + REQUIRE(shift == 0); } else { // if in_t=int8_t ensure that an int32_t accumulator can be used - assert(0 < shift && shift <= 11); + REQUIRE(0 < shift && shift <= 11); // set a consistent lower limit of 1/16 downscale // independent of the shift value to simplify implementations - assert(0 < stride_x && stride_x < (16 << shift)); - assert(0 < stride_y && stride_y < (16 << shift)); + REQUIRE(0 < stride_x && stride_x < (16 << shift)); + REQUIRE(0 < stride_y && stride_y < (16 << shift)); // offset range is similarly limited to maximum 16 pixels irrespective // of shift. Both stride and offset fit in int16_t when shift=11. - assert((-16 << shift) < offset_x && offset_x < (16 << shift)); - assert((-16 << shift) < offset_y && offset_y < (16 << shift)); + REQUIRE((-16 << shift) < offset_x && offset_x < (16 << shift)); + REQUIRE((-16 << shift) < offset_y && offset_y < (16 << shift)); } for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW; 0 <= c < C) { unit = (resize_t == float_t) ? 1.0 : (1 << shift); @@ -86,7 +86,7 @@ for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW; 0 <= c < C) { iy1 = apply_min(iy+1, IH-1); ix0 = apply_max(ix, 0); ix1 = apply_min(ix+1, IW-1); - assert(ix0 <= ix1 && iy0 <= iy1); + REQUIRE(ix0 <= ix1 && iy0 <= iy1); if (mode==BILINEAR) { v00 = tensor_read<in_t>(input, [N,IH,IW,C], [n,iy0,ix0,c]); v01 = tensor_read<in_t>(input, [N,IH,IW,C], [n,iy0,ix1,c]); |