diff options
author | Dominic Symes <dominic.symes@arm.com> | 2020-10-13 10:18:46 +0100 |
---|---|---|
committer | Dominic Symes <dominic.symes@arm.com> | 2020-10-14 07:54:31 +0000 |
commit | a07ca7a02e51802c6d19f9fba0990f1a46c35055 (patch) | |
tree | f232a18a39fdc74bef0b7f4f270a1dbd77b9d184 /chapters/data_layout.adoc | |
parent | 5bae9b73f5ce46fbe4360781e9c180da28bfd3cf (diff) | |
download | specification-a07ca7a02e51802c6d19f9fba0990f1a46c35055.tar.gz |
Updates to reduction and reverse operations
Simplify the reduction and reverse reference
by apply one axis at a time and default to
keep_dims. (Changes to shape can be done
separately with RESHAPE)
Signed-off-by: Dominic Symes <dominic.symes@arm.com>
Change-Id: I590bdb6bc05b1c673f86e3f45f0a43536d8f362a
Diffstat (limited to 'chapters/data_layout.adoc')
-rw-r--r-- | chapters/data_layout.adoc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/chapters/data_layout.adoc b/chapters/data_layout.adoc index 8f318ae..3a7c3c3 100644 --- a/chapters/data_layout.adoc +++ b/chapters/data_layout.adoc @@ -135,7 +135,7 @@ for (i=0; i<tensor_size(shape); i++) { ==== REVERSE -Returns a tensor with the same type/values as the input, with the data reversed along the given axes. No data conversion happens during a reverse operation. +Returns a tensor with the same type/values as the input, with the data reversed along the given axis. No data conversion happens during a reverse operation. *Arguments:* @@ -143,19 +143,18 @@ Returns a tensor with the same type/values as the input, with the data reversed |Argument|Type|Name|Shape|Description |Input|in_t*|input|shape|Input tensor from 1 to 4 dims -|Attribute|int|axes|[]|List of axes along which to reverse with size from 1 to rank(input1). Values are integers into the 0-based dimensions of the input tensor. An empty list is not allowed. -|Output|out_t*|output|shape|Output tensor of same type, size as the input tensor +|Attribute|int|axis|-|Axis to reverse +|Output|out_t*|output|shape|Output tensor. Same shape as input tensor. |=== *Operation Function:* [source,c] ---- +assert(0<=axis && axis<dimensions(shape)) for_each (index in shape) { tmp_index = index; - for_each (axis in axes[]) { - tmp_index[axis] = shape[axis]-1-index[axis] - } + tmp_index[axis] = shape[axis]-1-index[axis]; value = tensor_read<in_t>(input, shape, tmp_index); tensor_write<in_t>(output, shape, index, value); } |