aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference/workloads/Gather.cpp
diff options
context:
space:
mode:
authorEllen Norris-Thompson <ellen.norris-thompson@arm.com>2019-06-21 15:50:00 +0100
committerEllen Norris-Thompson <ellen.norris-thompson@arm.com>2019-06-24 11:14:48 +0100
commit6858d3fb714cc20d5fcfd814c35ed3a84dc82145 (patch)
treedb6a6651fff0dce4095be58bc155e63175abe33e /src/backends/reference/workloads/Gather.cpp
parent389aa70c8a24fa2faf33df5f8cd9a99b0fabe971 (diff)
downloadarmnn-6858d3fb714cc20d5fcfd814c35ed3a84dc82145.tar.gz
IVGCVSW-3247: Refactor reference Gather workload
* Refactored Gather reference workload to not use templates for different types * Added quantization values in Gather unit tests for Quantized types Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com> Change-Id: Ibe5d655aa1c287824e45b83818c5862bda7f92b0
Diffstat (limited to 'src/backends/reference/workloads/Gather.cpp')
-rw-r--r--src/backends/reference/workloads/Gather.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/backends/reference/workloads/Gather.cpp b/src/backends/reference/workloads/Gather.cpp
index 45491c7f52..c848a7c138 100644
--- a/src/backends/reference/workloads/Gather.cpp
+++ b/src/backends/reference/workloads/Gather.cpp
@@ -14,13 +14,12 @@
namespace armnn
{
-template <typename T>
void Gather(const TensorInfo& paramsInfo,
const TensorInfo& indicesInfo,
const TensorInfo& outputInfo,
- const T* params,
+ Decoder<float>& params,
const int32_t* indices,
- T* output)
+ Encoder<float>& output)
{
const TensorShape& paramsShape = paramsInfo.GetShape();
@@ -39,9 +38,13 @@ void Gather(const TensorInfo& paramsInfo,
unsigned int startOffset = indx * paramsProduct;
unsigned int endOffset = startOffset + paramsProduct;
+
for (unsigned int j = startOffset; j < endOffset; ++j)
{
- output[outIndex] = params[j];
+ params[j];
+ float outputValue = params.Get();
+ output[outIndex];
+ output.Set(outputValue);
++outIndex;
}
}
@@ -49,18 +52,4 @@ void Gather(const TensorInfo& paramsInfo,
BOOST_ASSERT(outIndex == outputInfo.GetNumElements());
}
-template void Gather<float>(const TensorInfo& paramsInfo,
- const TensorInfo& indicesInfo,
- const TensorInfo& outputInfo,
- const float* params,
- const int32_t* indices,
- float* output);
-
-template void Gather<uint8_t>(const TensorInfo& paramsInfo,
- const TensorInfo& indicesInfo,
- const TensorInfo& outputInfo,
- const uint8_t* params,
- const int32_t* indices,
- uint8_t* output);
-
} //namespace armnn