From ba257e3a99f9edc06d131a53f88628cad9a3c236 Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Wed, 5 Jun 2019 09:17:33 +0100 Subject: IVGCVSW-3212 Refactor the Reference BatchNormalization workloads * Used the new DataLayoutIndexed::GetIndexmethod in BatchNormImpl for convenience Change-Id: Ifb7e5abbdb48d958ee2139d22b97cd8d479357bc Signed-off-by: Matteo Martincigh --- src/backends/reference/workloads/BatchNormImpl.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 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); -- cgit v1.2.1