From 23418f7246acee8f1fd475c118e663c8dc9fc7db Mon Sep 17 00:00:00 2001 From: Dominic Symes Date: Fri, 30 Oct 2020 17:34:19 +0000 Subject: GATHER: Add operation code Add the operation code for GATHER and reduce number of arguments. Signed-off-by: Dominic Symes Change-Id: I51b6ede43dcae1e1aec7a11a75a1e4bf6c668673 --- chapters/scatter_gather.adoc | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/chapters/scatter_gather.adoc b/chapters/scatter_gather.adoc index 29ba391..cfee60b 100644 --- a/chapters/scatter_gather.adoc +++ b/chapters/scatter_gather.adoc @@ -11,30 +11,43 @@ ==== GATHER -Generate a tensor for which each element in the output is a subtensor of the values tensor along the given axis, based on the value of indices. +Generate a tensor for which each element in the output is a subtensor of the values tensor based on the indices. +N is the number of batches, W the number of indices in each batch, K the range of each index and C the number data channels for each index. *Arguments:* |=== |Argument|Type|Name|Shape|Description -|Input|index_t*|indices|shape|Input tensor from 1 to 4 dims -|Input|value_t*|values|shape|Input tensor from 1 to 4 dims. Must be of rank at least axis + 1 -|Attribute|int|axis|-|Scalar value denoting which dimension to be used for striding. -|Output|out_t*|output|shape|Output tensor +|Input|value_t*|values|[N,K,C]|3D value tensor +|Input|index_t*|indices|[N,W]|2D index tensor +|Output|value_t*|output|[N,W,C]|3D output tensor |=== *Quantization Parameters:* None +*Operation Function:* + +[source,c] +---- +for_each(0<=n(indices, [N,W], [n,w]) + assert(0<=k && k(values, [N,K,C], [n, k, c]) + tensor_write(output, [N,W,C], [n,w,c]) +} +---- + *Supported Data Types:* |=== -|Profile|Mode|index_t|value_t|out_t +|Profile|Mode|index_t|value_t -|Any|signed 8|int8/int16|aint8|aint8 -|Any|signed 16|int8/int16|int16|int16 -|Any|signed 32|int8/int16|int32|int32 +|Any|signed 8|int32|aint8 +|Any|signed 16|int32|int16 +|Any|signed 32|int32|int32 +|MI,MT|float|int32|float |=== -- cgit v1.2.1