aboutsummaryrefslogtreecommitdiff
path: root/chapters/pseudocode.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'chapters/pseudocode.adoc')
-rw-r--r--chapters/pseudocode.adoc9
1 files changed, 9 insertions, 0 deletions
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;
+}
----