From c1e39d5b5ce31234f1d03aebfb960859f234f12b Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Fri, 7 Jan 2022 14:34:01 -0800 Subject: Simplify shape checking for TRANSPOSE Have a simple outer check for proper size rather than checking during the inner loop. Change-Id: I20312c5f6b4aacbb630a2df0f901d8586caa04c0 Signed-off-by: Eric Kunze --- chapters/data_layout.adoc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/chapters/data_layout.adoc b/chapters/data_layout.adoc index e50a14e..395843a 100644 --- a/chapters/data_layout.adoc +++ b/chapters/data_layout.adoc @@ -309,11 +309,17 @@ for_each(index in perms) { ERROR_IF(indexes_used[index] == true); indexes_used[index] = true; } + +// Ensure that the output shapes have the properly +// permuted shapes +for(i = 0; i < rank(shape); i++) { + ERROR_IF(shape1[perms[i]] != shape[i]) +} + for_each(index in shape) { tmp_index = index; for(i = 0; i < rank(shape); i++) { - REQUIRE(shape1[perm[i]] == shape[i]) - tmp_index[perm[i]] = index[i] + tmp_index[perms[i]] = index[i] } in_out_t value = tensor_read(input, shape1, tmp_index); tensor_write(output, shape, index, value); -- cgit v1.2.1