aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/layers
diff options
context:
space:
mode:
authorMatthew Sloyan <matthew.sloyan@arm.com>2020-09-14 11:47:26 +0100
committerJan Eilers <jan.eilers@arm.com>2020-09-17 09:41:12 +0000
commit0663d66c64d8f1cb2b6158f9018c9ba19e2c504b (patch)
treeab8370395d7009f109e15463dbcf644191c1d639 /src/armnn/layers
parent171214c8ff275c90cd4f7fc23a34ec2c83b5ea39 (diff)
downloadarmnn-0663d66c64d8f1cb2b6158f9018c9ba19e2c504b.tar.gz
IVGCVSW-5303 Remove some boost::numeric_cast from rest of ArmNN
* Replaced with armnn/utility/NumericCast.hpp * Exclusions in TypeUtils.cpp and QuantizerVisitor.cpp * Excluded as requires float implementation in NumericCast.hpp Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com> Change-Id: I5c4c60e7028e1a51bf9379457278d253fd37bc70
Diffstat (limited to 'src/armnn/layers')
-rw-r--r--src/armnn/layers/MeanLayer.cpp6
-rw-r--r--src/armnn/layers/PreluLayer.cpp14
-rw-r--r--src/armnn/layers/SliceLayer.cpp5
-rw-r--r--src/armnn/layers/StridedSliceLayer.cpp8
4 files changed, 18 insertions, 15 deletions
diff --git a/src/armnn/layers/MeanLayer.cpp b/src/armnn/layers/MeanLayer.cpp
index a1a3a40d95..0c5959ca0d 100644
--- a/src/armnn/layers/MeanLayer.cpp
+++ b/src/armnn/layers/MeanLayer.cpp
@@ -6,6 +6,8 @@
#include "MeanLayer.hpp"
#include "LayerCloneBase.hpp"
+#include <armnn/utility/NumericCast.hpp>
+
#include <backendsCommon/CpuTensorHandle.hpp>
#include <backendsCommon/WorkloadData.hpp>
#include <backendsCommon/WorkloadFactory.hpp>
@@ -69,7 +71,7 @@ void MeanLayer::ValidateTensorShapesFromInputs()
}
else
{
- outputRank = input.GetNumDimensions() - boost::numeric_cast<unsigned int>(m_Param.m_Axis.size());
+ outputRank = input.GetNumDimensions() - armnn::numeric_cast<unsigned int>(m_Param.m_Axis.size());
if (outputRank == 0)
{
outputRank = 1;
@@ -85,7 +87,7 @@ void MeanLayer::ValidateTensorShapesFromInputs()
{
if (std::find(m_Param.m_Axis.begin(), m_Param.m_Axis.end(), i) == m_Param.m_Axis.end())
{
- dimSizes[outputIndex] = boost::numeric_cast<unsigned int>(input.GetShape()[i]);
+ dimSizes[outputIndex] = armnn::numeric_cast<unsigned int>(input.GetShape()[i]);
++outputIndex;
}
else if (m_Param.m_KeepDims)
diff --git a/src/armnn/layers/PreluLayer.cpp b/src/armnn/layers/PreluLayer.cpp
index a57aa85147..365dd4fadc 100644
--- a/src/armnn/layers/PreluLayer.cpp
+++ b/src/armnn/layers/PreluLayer.cpp
@@ -7,6 +7,8 @@
#include "LayerCloneBase.hpp"
+#include <armnn/utility/NumericCast.hpp>
+
#include <backendsCommon/WorkloadData.hpp>
#include <backendsCommon/WorkloadFactory.hpp>
#include <backendsCommon/CpuTensorHandle.hpp>
@@ -52,15 +54,15 @@ std::vector<TensorShape> PreluLayer::InferOutputShapes(const std::vector<TensorS
TensorShape outputShape(outputDimensions);
- int inputShapeIndex = boost::numeric_cast<int>(inputShapeDimensions) - 1;
- int alphaShapeIndex = boost::numeric_cast<int>(alphaShapeDimensions) - 1;
+ int inputShapeIndex = armnn::numeric_cast<int>(inputShapeDimensions) - 1;
+ int alphaShapeIndex = armnn::numeric_cast<int>(alphaShapeDimensions) - 1;
unsigned int outputShapeIndex = outputDimensions - 1;
// Loop backwards through the common part of the shapes
while (inputShapeIndex >= 0 && alphaShapeIndex >= 0)
{
- unsigned int inputDimension = inputShape[boost::numeric_cast<unsigned int>(inputShapeIndex)];
- unsigned int alphaDimension = alphaShape[boost::numeric_cast<unsigned int>(alphaShapeIndex)];
+ unsigned int inputDimension = inputShape[armnn::numeric_cast<unsigned int>(inputShapeIndex)];
+ unsigned int alphaDimension = alphaShape[armnn::numeric_cast<unsigned int>(alphaShapeIndex)];
// Check that the inputs are broadcast compatible
ARMNN_ASSERT_MSG(inputDimension == alphaDimension || inputDimension == 1 || alphaDimension == 1,
@@ -76,7 +78,7 @@ std::vector<TensorShape> PreluLayer::InferOutputShapes(const std::vector<TensorS
// Loop backwards through the remaing part of the input shape (if any)
while (inputShapeIndex >= 0)
{
- outputShape[outputShapeIndex] = inputShape[boost::numeric_cast<unsigned int>(inputShapeIndex)];
+ outputShape[outputShapeIndex] = inputShape[armnn::numeric_cast<unsigned int>(inputShapeIndex)];
inputShapeIndex--;
outputShapeIndex--;
@@ -85,7 +87,7 @@ std::vector<TensorShape> PreluLayer::InferOutputShapes(const std::vector<TensorS
// Loop backwards through the remaing part of the alpha shape (if any)
while (alphaShapeIndex >= 0)
{
- outputShape[outputShapeIndex] = alphaShape[boost::numeric_cast<unsigned int>(alphaShapeIndex)];
+ outputShape[outputShapeIndex] = alphaShape[armnn::numeric_cast<unsigned int>(alphaShapeIndex)];
alphaShapeIndex--;
outputShapeIndex--;
diff --git a/src/armnn/layers/SliceLayer.cpp b/src/armnn/layers/SliceLayer.cpp
index 0f1d4386d7..bfa16e5f9e 100644
--- a/src/armnn/layers/SliceLayer.cpp
+++ b/src/armnn/layers/SliceLayer.cpp
@@ -8,12 +8,11 @@
#include "LayerCloneBase.hpp"
#include <armnn/TypesUtils.hpp>
+#include <armnn/utility/NumericCast.hpp>
#include <backendsCommon/WorkloadData.hpp>
#include <backendsCommon/WorkloadFactory.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-
namespace armnn
{
@@ -53,7 +52,7 @@ std::vector<TensorShape> SliceLayer::InferOutputShapes(const std::vector<TensorS
IgnoreUnused(inputShapes);
ARMNN_ASSERT(inputShapes.size() == 1);
- TensorShape outputShape(boost::numeric_cast<unsigned int>(m_Param.m_Size.size()), m_Param.m_Size.data());
+ TensorShape outputShape(armnn::numeric_cast<unsigned int>(m_Param.m_Size.size()), m_Param.m_Size.data());
return std::vector<TensorShape>({ outputShape });
}
diff --git a/src/armnn/layers/StridedSliceLayer.cpp b/src/armnn/layers/StridedSliceLayer.cpp
index 9b1706b335..957f5858b6 100644
--- a/src/armnn/layers/StridedSliceLayer.cpp
+++ b/src/armnn/layers/StridedSliceLayer.cpp
@@ -6,11 +6,11 @@
#include "LayerCloneBase.hpp"
+#include <armnn/utility/NumericCast.hpp>
+
#include <backendsCommon/WorkloadData.hpp>
#include <backendsCommon/WorkloadFactory.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-
namespace armnn
{
@@ -82,7 +82,7 @@ std::vector<TensorShape> StridedSliceLayer::InferOutputShapes(
newSize = std::max(0, newSize);
- outputShape.push_back(boost::numeric_cast<unsigned int>(newSize));
+ outputShape.push_back(armnn::numeric_cast<unsigned int>(newSize));
}
if (outputShape.size() == 0 && (inputShape.GetNumDimensions() - amountDimShrunk) == 0)
@@ -91,7 +91,7 @@ std::vector<TensorShape> StridedSliceLayer::InferOutputShapes(
}
return std::vector<TensorShape>({
- TensorShape(boost::numeric_cast<unsigned int>(outputShape.size()), &outputShape[0]) });
+ TensorShape(armnn::numeric_cast<unsigned int>(outputShape.size()), &outputShape[0]) });
}
void StridedSliceLayer::ValidateTensorShapesFromInputs()