diff options
author | James Conroy <james.conroy@arm.com> | 2018-10-19 10:41:35 +0100 |
---|---|---|
committer | Matthew Bentham <matthew.bentham@arm.com> | 2018-10-22 16:57:54 +0100 |
commit | 69482271d3e02af950d2d0f1947ae6c3eeed537b (patch) | |
tree | d0ef56a1ba2d314eb821ce2b6bb8e09773f41a17 /src/backends/reference/workloads | |
parent | dd6aceaa884815e68ed69fca71de81babd3204da (diff) | |
download | armnn-69482271d3e02af950d2d0f1947ae6c3eeed537b.tar.gz |
IVGCVSW-2024: Support NHWC for Pooling2D CpuRef
* Adds implementation to plumb DataLayout parameter
for Pooling2D on CpuRef.
* Adds unit tests to execute Pooling2D on CpuRef
using NHWC data layout.
* Refactors original tests to use DataLayoutIndexed
and removes duplicate code.
Change-Id: Ife7e0861a886cf58a2042e5be20e5b27af4528c9
Diffstat (limited to 'src/backends/reference/workloads')
-rw-r--r-- | src/backends/reference/workloads/Pooling2d.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/backends/reference/workloads/Pooling2d.cpp b/src/backends/reference/workloads/Pooling2d.cpp index 5812a290e7..9890920113 100644 --- a/src/backends/reference/workloads/Pooling2d.cpp +++ b/src/backends/reference/workloads/Pooling2d.cpp @@ -143,12 +143,16 @@ void Pooling2d(const float* in, const TensorInfo& outputInfo, const Pooling2dDescriptor& params) { + const unsigned int channelsIndex = params.m_DataLayout.GetChannelsIndex(); + const unsigned int heightIndex = params.m_DataLayout.GetHeightIndex(); + const unsigned int widthIndex = params.m_DataLayout.GetWidthIndex(); + const int batchSize = boost::numeric_cast<int>(outputInfo.GetShape()[0]); - const int channels = boost::numeric_cast<int>(outputInfo.GetShape()[1]); - const int heightOutput = boost::numeric_cast<int>(outputInfo.GetShape()[2]); - const int widthOutput = boost::numeric_cast<int>(outputInfo.GetShape()[3]); - const int heightInput = boost::numeric_cast<int>(inputInfo.GetShape()[2]); - const int widthInput = boost::numeric_cast<int>(inputInfo.GetShape()[3]); + const int channels = boost::numeric_cast<int>(outputInfo.GetShape()[channelsIndex]); + const int heightOutput = boost::numeric_cast<int>(outputInfo.GetShape()[heightIndex]); + const int widthOutput = boost::numeric_cast<int>(outputInfo.GetShape()[widthIndex]); + const int heightInput = boost::numeric_cast<int>(inputInfo.GetShape()[heightIndex]); + const int widthInput = boost::numeric_cast<int>(inputInfo.GetShape()[widthIndex]); const int padLeft = boost::numeric_cast<int>(params.m_PadLeft); const int padRight = boost::numeric_cast<int>(params.m_PadRight); const int padTop = boost::numeric_cast<int>(params.m_PadTop); |