aboutsummaryrefslogtreecommitdiff
path: root/chapters/data_layout.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'chapters/data_layout.adoc')
-rw-r--r--chapters/data_layout.adoc10
1 files changed, 5 insertions, 5 deletions
diff --git a/chapters/data_layout.adoc b/chapters/data_layout.adoc
index 3a7c3c3..bec551b 100644
--- a/chapters/data_layout.adoc
+++ b/chapters/data_layout.adoc
@@ -77,7 +77,7 @@ Zero-pads a tensor along borders of each dimension.
----
for_each (index in shape) {
index1 = index
- for (i=0; i<dimensions(shape); i++) {
+ for (i=0; i<rank(shape); i++) {
index1[i] = index1[i] - padding[i,0]
}
value = tensor_read<in_t>(input1, shape1, index1, input1_zp, padding)
@@ -151,7 +151,7 @@ Returns a tensor with the same type/values as the input, with the data reversed
[source,c]
----
-assert(0<=axis && axis<dimensions(shape))
+assert(0<=axis && axis<rank(shape))
for_each (index in shape) {
tmp_index = index;
tmp_index[axis] = shape[axis]-1-index[axis];
@@ -192,7 +192,7 @@ Extracts a slice of the input tensor 0 on the given axis, beginning at the start
----
for_each (index in shape) {
tmp_index = index;
- for (i=0; i<dimensions(shape); i++) {
+ for (i=0; i<rank(shape); i++) {
tmp_index[i] = index[i] + start[i];
}
value = tensor_read<in_t>(input, shape1, tmp_index);
@@ -232,7 +232,7 @@ Replicates input 0 multiplies times along each dimension.
----
for_each (index in shape) {
tmp_index = index;
- for (i=0; i<dimensions(shape); i++) {
+ for (i=0; i<rank(shape); i++) {
assert(shape1[i] * multiplies[i] == shape[i])
tmp_index[i] = index[i] % shape1[i]
}
@@ -273,7 +273,7 @@ Permutes the dimensions based on perm.
----
for_each (index in shape) {
tmp_index = index;
- for (i=0; i<dimensions(shape); i++) {
+ for (i=0; i<rank(shape); i++) {
assert(shape1[perm[i]] == shape[i])
tmp_index[perm[i]] = index[i]
}