From a9101530d8ea7a3cb470b722bc6cf8745ab283ac Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Thu, 17 Jun 2021 18:01:09 -0700 Subject: 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 --- chapters/data_layout.adoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'chapters/data_layout.adoc') diff --git a/chapters/data_layout.adoc b/chapters/data_layout.adoc index de90322..09df5be 100644 --- a/chapters/data_layout.adoc +++ b/chapters/data_layout.adoc @@ -121,7 +121,7 @@ Returns a tensor with the same type/values as the input, with a new shape specif [source,c++] ---- -assert(tensor_size(shape1) == tensor_size(shape)); +REQUIRE(tensor_size(shape1) == tensor_size(shape)); for(i = 0; i < tensor_size(shape); i++) { output[i] = input[i]; } @@ -157,7 +157,7 @@ Returns a tensor with the same type/values as the input, with the data reversed [source,c++] ---- -assert(0 <= axis && axis < rank(shape)); +REQUIRE(0 <= axis && axis < rank(shape)); for_each(index in shape) { tmp_index = index; tmp_index[axis] = shape[axis] - 1 - index[axis]; @@ -240,7 +240,7 @@ Replicates input1 multiplies times along each dimension. for_each(index in shape) { tmp_index = index; for(i = 0; i < rank(shape); i++) { - assert(shape1[i] * multiplies[i] == shape[i]); + REQUIRE(shape1[i] * multiplies[i] == shape[i]); tmp_index[i] = index[i] % shape1[i]; } in_t value = tensor_read(input, shape1, tmp_index); @@ -281,7 +281,7 @@ Permutes the dimensions based on perm. for_each(index in shape) { tmp_index = index; for(i = 0; i < rank(shape); i++) { - assert(shape1[perm[i]] == shape[i]) + REQUIRE(shape1[perm[i]] == shape[i]) tmp_index[perm[i]] = index[i] } in_t value = tensor_read(input, shape1, tmp_index); -- cgit v1.2.1