From 844b3b4745e673502e80899a005933b1fc1fd72e Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Tue, 24 May 2022 15:24:17 -0700 Subject: Update RESHAPE pseudocode Remove the calculation of a -1 dimension from the operator. Calculates the new coordinates, and adds the proper tensor_read/tensor_write for the data. Signed-off-by: Eric Kunze Change-Id: Iad1d83c170732bdfb3652dead9044809168b23d2 --- chapters/pseudocode.adoc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'chapters/pseudocode.adoc') diff --git a/chapters/pseudocode.adoc b/chapters/pseudocode.adoc index a370880..d22d180 100644 --- a/chapters/pseudocode.adoc +++ b/chapters/pseudocode.adoc @@ -203,4 +203,13 @@ int32_t sum(in_t input[]) bool isNaN(float input) return True if floating-point input value is NaN + +// Input is the shape of the given tensor +int32_t tensor_size(int32_t input[]) { + int32_t size = 1; + for (int32_t i=0; i < rank(input); i++) { + size *= input[i]; + } + return size; +} ---- -- cgit v1.2.1