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 --- .../workloads/RefNormalizationWorkload.cpp | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/backends/reference/workloads/RefNormalizationWorkload.cpp') diff --git a/src/backends/reference/workloads/RefNormalizationWorkload.cpp b/src/backends/reference/workloads/RefNormalizationWorkload.cpp index a41f68349a..d5d2104cba 100644 --- a/src/backends/reference/workloads/RefNormalizationWorkload.cpp +++ b/src/backends/reference/workloads/RefNormalizationWorkload.cpp @@ -8,11 +8,10 @@ #include #include #include +#include #include -#include - #include "RefWorkloadUtils.hpp" #include "Decoders.hpp" #include "Encoders.hpp" @@ -37,7 +36,7 @@ void NormalizeWithinUingLbr(Decoder& inputData, const unsigned int rows = tensorShape[2]; const unsigned int cols = tensorShape[3]; - int radius = boost::numeric_cast(norm_size / 2u); /* Strong Assumption on rounding Mode */ + int radius = armnn::numeric_cast(norm_size / 2u); /* Strong Assumption on rounding Mode */ for (unsigned int n = 0; n < batchSize; n++) { @@ -52,23 +51,23 @@ void NormalizeWithinUingLbr(Decoder& inputData, { for (int x = -radius; x <= radius; x++) { - int i = boost::numeric_cast(w) + x; - int j = boost::numeric_cast(h) + y; + int i = armnn::numeric_cast(w) + x; + int j = armnn::numeric_cast(h) + y; - if ((i < 0) || (i >= boost::numeric_cast(cols))) + if ((i < 0) || (i >= armnn::numeric_cast(cols))) { continue; } - if ((j < 0) || (j >= boost::numeric_cast(rows))) + if ((j < 0) || (j >= armnn::numeric_cast(rows))) { continue; } unsigned int inputIndex = n * cols * rows * depth + c * cols * rows + - boost::numeric_cast(j) * cols + - boost::numeric_cast(i); + armnn::numeric_cast(j) * cols + + armnn::numeric_cast(i); inputData[inputIndex]; float inval = inputData.Get(); @@ -106,7 +105,7 @@ void NormalizeAcrossUingLbr(Decoder& inputData, const unsigned int rows = tensorShape[dataLayoutIndexed.GetHeightIndex()]; const unsigned int cols = tensorShape[dataLayoutIndexed.GetWidthIndex()]; - int radius = boost::numeric_cast(norm_size / 2u); /* Strong Assumption on rounding Mode */ + int radius = armnn::numeric_cast(norm_size / 2u); /* Strong Assumption on rounding Mode */ for (unsigned int n = 0; n < batchSize; n++) { @@ -119,16 +118,16 @@ void NormalizeAcrossUingLbr(Decoder& inputData, float accumulated_scale = 0.0; for (int z = -radius; z <= radius; z++) { - int k = boost::numeric_cast(c) + z; + int k = armnn::numeric_cast(c) + z; - if ((k < 0) || (k >= boost::numeric_cast(depth))) + if ((k < 0) || (k >= armnn::numeric_cast(depth))) { continue; } unsigned inputIndex = dataLayoutIndexed.GetIndex(tensorShape, n, - boost::numeric_cast(k), + armnn::numeric_cast(k), h, w); -- cgit v1.2.1