From 171214c8ff275c90cd4f7fc23a34ec2c83b5ea39 Mon Sep 17 00:00:00 2001 From: Matthew Sloyan Date: Wed, 9 Sep 2020 09:07:37 +0100 Subject: IVGCVSW-5300 Remove some boost::numeric_cast from armnn/backends * Replaced with armnn/utility/NumericCast.hpp * Some exclusions in reference backend * Excluded as requires float implementation in NumericCast.hpp Signed-off-by: Matthew Sloyan Change-Id: I9e4e9cd502c865452128fa04415fd6f250baa855 --- src/backends/reference/workloads/Pooling2d.cpp | 53 +++++++++++++------------- 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'src/backends/reference/workloads/Pooling2d.cpp') diff --git a/src/backends/reference/workloads/Pooling2d.cpp b/src/backends/reference/workloads/Pooling2d.cpp index 9b220619a4..435671ffad 100644 --- a/src/backends/reference/workloads/Pooling2d.cpp +++ b/src/backends/reference/workloads/Pooling2d.cpp @@ -9,6 +9,7 @@ #include #include +#include #include @@ -151,20 +152,20 @@ void Pooling2d(Decoder& rInputDecoder, auto heightIndex = dataLayout.GetHeightIndex(); auto widthIndex = dataLayout.GetWidthIndex(); - const int batchSize = boost::numeric_cast(outputInfo.GetShape()[0]); - const int channels = boost::numeric_cast(outputInfo.GetShape()[channelsIndex]); - const int heightOutput = boost::numeric_cast(outputInfo.GetShape()[heightIndex]); - const int widthOutput = boost::numeric_cast(outputInfo.GetShape()[widthIndex]); - const int heightInput = boost::numeric_cast(inputInfo.GetShape()[heightIndex]); - const int widthInput = boost::numeric_cast(inputInfo.GetShape()[widthIndex]); - const int padLeft = boost::numeric_cast(params.m_PadLeft); - const int padRight = boost::numeric_cast(params.m_PadRight); - const int padTop = boost::numeric_cast(params.m_PadTop); - const int padBottom = boost::numeric_cast(params.m_PadBottom); - const int strideX = boost::numeric_cast(params.m_StrideX); - const int strideY = boost::numeric_cast(params.m_StrideY); - const int poolHeight = boost::numeric_cast(params.m_PoolHeight); - const int poolWidth = boost::numeric_cast(params.m_PoolWidth); + const int batchSize = armnn::numeric_cast(outputInfo.GetShape()[0]); + const int channels = armnn::numeric_cast(outputInfo.GetShape()[channelsIndex]); + const int heightOutput = armnn::numeric_cast(outputInfo.GetShape()[heightIndex]); + const int widthOutput = armnn::numeric_cast(outputInfo.GetShape()[widthIndex]); + const int heightInput = armnn::numeric_cast(inputInfo.GetShape()[heightIndex]); + const int widthInput = armnn::numeric_cast(inputInfo.GetShape()[widthIndex]); + const int padLeft = armnn::numeric_cast(params.m_PadLeft); + const int padRight = armnn::numeric_cast(params.m_PadRight); + const int padTop = armnn::numeric_cast(params.m_PadTop); + const int padBottom = armnn::numeric_cast(params.m_PadBottom); + const int strideX = armnn::numeric_cast(params.m_StrideX); + const int strideY = armnn::numeric_cast(params.m_StrideY); + const int poolHeight = armnn::numeric_cast(params.m_PoolHeight); + const int poolWidth = armnn::numeric_cast(params.m_PoolWidth); float defaultInitializer = DefaultInitializer(params.m_PoolType); @@ -221,10 +222,10 @@ void Pooling2d(Decoder& rInputDecoder, result = 0.0f; unsigned int outputIndex = dataLayout.GetIndex(outputShape, - boost::numeric_cast(n), - boost::numeric_cast(c), - boost::numeric_cast(yOutput), - boost::numeric_cast(xOutput)); + armnn::numeric_cast(n), + armnn::numeric_cast(c), + armnn::numeric_cast(yOutput), + armnn::numeric_cast(xOutput)); rOutputEncoder[outputIndex]; rOutputEncoder.Set(result); continue; @@ -244,10 +245,10 @@ void Pooling2d(Decoder& rInputDecoder, for (auto xInput = wstart; xInput < wend; xInput++) { unsigned int inputIndex = dataLayout.GetIndex(inputShape, - boost::numeric_cast(n), - boost::numeric_cast(c), - boost::numeric_cast(yInput), - boost::numeric_cast(xInput)); + armnn::numeric_cast(n), + armnn::numeric_cast(c), + armnn::numeric_cast(yInput), + armnn::numeric_cast(xInput)); rInputDecoder[inputIndex]; float inval = rInputDecoder.Get(); @@ -259,10 +260,10 @@ void Pooling2d(Decoder& rInputDecoder, execute(result, poolAreaSize); unsigned int outputIndex = dataLayout.GetIndex(outputShape, - boost::numeric_cast(n), - boost::numeric_cast(c), - boost::numeric_cast(yOutput), - boost::numeric_cast(xOutput)); + armnn::numeric_cast(n), + armnn::numeric_cast(c), + armnn::numeric_cast(yOutput), + armnn::numeric_cast(xOutput)); rOutputEncoder[outputIndex]; rOutputEncoder.Set(result); -- cgit v1.2.1