From 589e3e81a86c83456580e112978bf7a0ed5f43ac Mon Sep 17 00:00:00 2001 From: Matthew Sloyan Date: Fri, 11 Sep 2020 16:17:48 +0100 Subject: IVGCVSW-5302 Remove some boost::numeric_cast from parsers * Replaced with armnn/utility/NumericCast.hpp * Exclusions in armnnCaffeParser * Three excluded as requires float implementation in NumericCast.hpp Signed-off-by: Matthew Sloyan Change-Id: Ib468b606238694334a8319d0ed5db381ce37a915 --- src/armnnCaffeParser/RecordByRecordCaffeParser.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/armnnCaffeParser/RecordByRecordCaffeParser.cpp') diff --git a/src/armnnCaffeParser/RecordByRecordCaffeParser.cpp b/src/armnnCaffeParser/RecordByRecordCaffeParser.cpp index cb7943655d..a59725cbd2 100644 --- a/src/armnnCaffeParser/RecordByRecordCaffeParser.cpp +++ b/src/armnnCaffeParser/RecordByRecordCaffeParser.cpp @@ -7,12 +7,10 @@ #include "armnn/Exceptions.hpp" #include "armnn/Utils.hpp" - +#include #include "GraphTopologicalSort.hpp" -#include - // Caffe #include @@ -282,7 +280,7 @@ std::unique_ptr AllocateBuffer(std::ifstream& ifs, VarLenDataInfo& dataI std::unique_ptr ptr(new char[dataInfo.SizeOfData()]); ifs.clear(); ifs.seekg(dataInfo.PositionOfData(), std::ios_base::beg); - ifs.read(ptr.get(), boost::numeric_cast(dataInfo.SizeOfData())); + ifs.read(ptr.get(), armnn::numeric_cast(dataInfo.SizeOfData())); return ptr; } @@ -299,12 +297,12 @@ VarLenDataInfo CreateVarLenDataInfo(std::streamoff bufferStart, std::streamoff e // on the platform in which I am currently compiling std::streamoff is signed long int and // size_t is unsigned long int so there is no way this error condition can fire but this stuff // is supposed to be portable so the check remains in place - if (boost::numeric_cast(sizeOfLayer) > SIZE_MAX) { + if (armnn::numeric_cast(sizeOfLayer) > SIZE_MAX) { std::stringstream ss; ss << "layer is greater than " << SIZE_MAX << " in size cannot process. layer size = [" << sizeOfLayer << "]"; throw armnn::ParseException(ss.str()); } - LayerParameterInfo info(bufferStart, boost::numeric_cast(sizeOfLayer)); + LayerParameterInfo info(bufferStart, armnn::numeric_cast(sizeOfLayer)); return info; } @@ -314,7 +312,7 @@ void ReadTopologicalInfoForLayerParameter(LayerParameterInfo& layerInfo, std::if ifs.clear(); ifs.seekg(layerInfo.PositionOfData(), std::ios_base::beg); std::streamoff endOfLayer = layerInfo.PositionOfData() + - boost::numeric_cast(layerInfo.SizeOfData()); + armnn::numeric_cast(layerInfo.SizeOfData()); while(true) { // check to see if we have reached the end of the record @@ -342,7 +340,7 @@ void ReadTopologicalInfoForLayerParameter(LayerParameterInfo& layerInfo, std::if { int size = ReadBase128(ifs); std::streamoff posStartOfData = ifs.tellg(); - VarLenDataInfo dataInfo(posStartOfData, boost::numeric_cast(size)); + VarLenDataInfo dataInfo(posStartOfData, armnn::numeric_cast(size)); //optional string name = 1; // the layer name //optional string type = 2; // the layer type //repeated string bottom = 3; // the name of each bottom blob @@ -684,7 +682,7 @@ armnn::INetworkPtr RecordByRecordCaffeParser::LoadLayers(std::ifstream& ifs, char *buffer = new char[info->SizeOfData()]; ifs.clear(); ifs.seekg(info->PositionOfData(), std::ios_base::beg); - ifs.read(buffer, boost::numeric_cast(info->SizeOfData())); + ifs.read(buffer, armnn::numeric_cast(info->SizeOfData())); bool bRet = layer.ParseFromArray(buffer, static_cast(info->SizeOfData())); delete[] buffer; if (!bRet) @@ -719,7 +717,7 @@ armnn::INetworkPtr RecordByRecordCaffeParser::LoadLayers(std::ifstream& ifs, { armnn::IOutputSlot& outputSlot = GetArmnnOutputSlotForCaffeTop(requestedOutput); - const armnn::LayerBindingId outputId = boost::numeric_cast( + const armnn::LayerBindingId outputId = armnn::numeric_cast( m_NetworkOutputsBindingInfo.size()); armnn::IConnectableLayer* const outputLayer = m_Network->AddOutputLayer(outputId, requestedOutput.c_str()); outputSlot.Connect(outputLayer->GetInputSlot(0)); -- cgit v1.2.1