aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-06-05 09:17:33 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-06-05 13:51:09 +0000
commitba257e3a99f9edc06d131a53f88628cad9a3c236 (patch)
tree71e34cf1746a95ac9912f6768e374454e3885d55
parent93f84a970a65446e1eb5227327a980b1f061cbef (diff)
downloadarmnn-ba257e3a99f9edc06d131a53f88628cad9a3c236.tar.gz
IVGCVSW-3212 Refactor the Reference BatchNormalization workloads
* Used the new DataLayoutIndexed::GetIndexmethod in BatchNormImpl for convenience Change-Id: Ifb7e5abbdb48d958ee2139d22b97cd8d479357bc Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
-rw-r--r--src/backends/reference/workloads/BatchNormImpl.cpp18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/backends/reference/workloads/BatchNormImpl.cpp b/src/backends/reference/workloads/BatchNormImpl.cpp
index 36e96d3fec..b80af8c937 100644
--- a/src/backends/reference/workloads/BatchNormImpl.cpp
+++ b/src/backends/reference/workloads/BatchNormImpl.cpp
@@ -53,23 +53,7 @@ void BatchNormImpl(const BatchNormalizationQueueDescriptor& data,
{
for (unsigned int w = 0; w < inputWidth; w++)
{
- unsigned int index = 0;
-
- if (dataLayout == DataLayout::NHWC)
- {
- index = n * inputHeight * inputWidth * inputChannels +
- h * inputWidth * inputChannels +
- w * inputChannels +
- c;
- }
- else // dataLayout == DataLayout::NCHW
- {
- index = n * inputHeight * inputWidth * inputChannels +
- c * inputHeight * inputWidth +
- h * inputWidth +
- w;
- }
-
+ unsigned int index = dataLayout.GetIndex(inputShape, n, c, h, w);
inputDecoder[index];
outputEncoder[index];
outputEncoder.Set(mult * inputDecoder.Get() + add);