From ef33cb192eef332fb3a26be742b341288421e5bc Mon Sep 17 00:00:00 2001 From: Kevin May Date: Fri, 29 Jan 2021 14:24:57 +0000 Subject: IVGCVSW-5592 Implement Pimpl Idiom for Caffe and Onnx Parsers Signed-off-by: Kevin May Change-Id: I760dc4f33c0f87113cda2fa924da70f2e8c19025 --- src/armnnCaffeParser/CaffeParser.cpp | 193 +++++++++++++-------- src/armnnCaffeParser/CaffeParser.hpp | 27 +-- src/armnnCaffeParser/RecordByRecordCaffeParser.cpp | 2 +- src/armnnCaffeParser/RecordByRecordCaffeParser.hpp | 2 +- 4 files changed, 135 insertions(+), 89 deletions(-) (limited to 'src/armnnCaffeParser') diff --git a/src/armnnCaffeParser/CaffeParser.cpp b/src/armnnCaffeParser/CaffeParser.cpp index 3ab473c2b4..dfb9cec206 100644 --- a/src/armnnCaffeParser/CaffeParser.cpp +++ b/src/armnnCaffeParser/CaffeParser.cpp @@ -60,6 +60,59 @@ using namespace caffe; using namespace std; using namespace google::protobuf::io; +ICaffeParser::ICaffeParser() : pCaffeParserImpl(new RecordByRecordCaffeParser()) {} + +ICaffeParser::~ICaffeParser() = default; + +ICaffeParser* ICaffeParser::CreateRaw() +{ + return new ICaffeParser(); +} + +ICaffeParserPtr ICaffeParser::Create() +{ + return ICaffeParserPtr(CreateRaw(), &ICaffeParser::Destroy); +} + +void ICaffeParser::Destroy(ICaffeParser* parser) +{ + delete parser; +} + +armnn::INetworkPtr ICaffeParser::CreateNetworkFromTextFile( + const char* graphFile, + const std::map& inputShapes, + const std::vector& requestedOutputs) +{ + return pCaffeParserImpl->CreateNetworkFromTextFile(graphFile, inputShapes, requestedOutputs); +} + +armnn::INetworkPtr ICaffeParser::CreateNetworkFromBinaryFile( + const char* graphFile, + const std::map& inputShapes, + const std::vector& requestedOutputs) +{ + return pCaffeParserImpl->CreateNetworkFromBinaryFile(graphFile, inputShapes,requestedOutputs); +} + +armnn::INetworkPtr ICaffeParser::CreateNetworkFromString( + const char* protoText, + const std::map& inputShapes, + const std::vector& requestedOutputs) +{ + return pCaffeParserImpl->CreateNetworkFromString(protoText, inputShapes, requestedOutputs); +} + +BindingPointInfo ICaffeParser::GetNetworkInputBindingInfo(const std::string& name) const +{ + return pCaffeParserImpl->GetNetworkInputBindingInfo(name); +} + +BindingPointInfo ICaffeParser::GetNetworkOutputBindingInfo(const std::string& name) const +{ + return pCaffeParserImpl->GetNetworkOutputBindingInfo(name); +} + namespace { @@ -232,63 +285,49 @@ ValueType GetOptionalWithFallback(const ParamType& param, } // namespace -const std::map - CaffeParserBase::ms_CaffeLayerNameToParsingFunctions = { - { "Input", &CaffeParserBase::ParseInputLayer }, - { "Convolution", &CaffeParserBase::ParseConvLayer }, - { "Deconvolution",&CaffeParserBase::ParseDeconvLayer }, - { "Pooling", &CaffeParserBase::ParsePoolingLayer }, - { "ReLU", &CaffeParserBase::ParseReluLayer }, - { "LRN", &CaffeParserBase::ParseLRNLayer }, - { "InnerProduct", &CaffeParserBase::ParseInnerProductLayer }, - { "Softmax", &CaffeParserBase::ParseSoftmaxLayer }, - { "Eltwise", &CaffeParserBase::ParseEltwiseLayer }, - { "Concat", &CaffeParserBase::ParseConcatLayer }, - { "BatchNorm", &CaffeParserBase::ParseBatchNormLayer }, - { "Scale", &CaffeParserBase::ParseScaleLayer }, - { "Split", &CaffeParserBase::ParseSplitLayer }, - { "Dropout", &CaffeParserBase::ParseDropoutLayer}, - { "ArgMax", &CaffeParserBase::ParseArgmaxLayer}, +const std::map + ICaffeParser::CaffeParserImpl::ms_CaffeLayerNameToParsingFunctions = { + { "Input", &CaffeParserImpl::ParseInputLayer }, + { "Convolution", &CaffeParserImpl::ParseConvLayer }, + { "Deconvolution",&CaffeParserImpl::ParseDeconvLayer }, + { "Pooling", &CaffeParserImpl::ParsePoolingLayer }, + { "ReLU", &CaffeParserImpl::ParseReluLayer }, + { "LRN", &CaffeParserImpl::ParseLRNLayer }, + { "InnerProduct", &CaffeParserImpl::ParseInnerProductLayer }, + { "Softmax", &CaffeParserImpl::ParseSoftmaxLayer }, + { "Eltwise", &CaffeParserImpl::ParseEltwiseLayer }, + { "Concat", &CaffeParserImpl::ParseConcatLayer }, + { "BatchNorm", &CaffeParserImpl::ParseBatchNormLayer }, + { "Scale", &CaffeParserImpl::ParseScaleLayer }, + { "Split", &CaffeParserImpl::ParseSplitLayer }, + { "Dropout", &CaffeParserImpl::ParseDropoutLayer}, + { "ArgMax", &CaffeParserImpl::ParseArgmaxLayer}, }; -ICaffeParser* ICaffeParser::CreateRaw() -{ - return new RecordByRecordCaffeParser(); -} - -ICaffeParserPtr ICaffeParser::Create() -{ - return ICaffeParserPtr(CreateRaw(), &ICaffeParser::Destroy); -} - -void ICaffeParser::Destroy(ICaffeParser* parser) -{ - delete parser; -} - -CaffeParserBase::CaffeParserBase() +ICaffeParser::CaffeParserImpl::CaffeParserImpl() : m_Network(nullptr, nullptr) { } CaffeParser::CaffeParser() -: CaffeParserBase() +: CaffeParserImpl() { } -BindingPointInfo CaffeParserBase::GetNetworkInputBindingInfo(const std::string& name) const +BindingPointInfo ICaffeParser::CaffeParserImpl::GetNetworkInputBindingInfo(const std::string& name) const { return GetBindingInfo(name, "input", m_NetworkInputsBindingInfo); } -BindingPointInfo CaffeParserBase::GetNetworkOutputBindingInfo(const std::string& name) const +BindingPointInfo ICaffeParser::CaffeParserImpl::GetNetworkOutputBindingInfo(const std::string& name) const { return GetBindingInfo(name, "output", m_NetworkOutputsBindingInfo); } -std::pair CaffeParserBase::GetBindingInfo(const std::string& layerName, +std::pair ICaffeParser::CaffeParserImpl::GetBindingInfo( + const std::string& layerName, const char* bindingPointDesc, const std::unordered_map& nameToBindingInfo) { @@ -304,7 +343,7 @@ std::pair CaffeParserBase::GetBindingI return it->second; } -TensorInfo CaffeParserBase::BlobShapeToTensorInfo(const caffe::BlobShape& blobShape) const +TensorInfo ICaffeParser::CaffeParserImpl::BlobShapeToTensorInfo(const caffe::BlobShape& blobShape) const { std::vector shape; for (int j = 0; j < blobShape.dim_size(); ++j) @@ -329,7 +368,7 @@ BlobShape TensorDescToBlobShape(const TensorInfo& desc) // Note: can move to CaffeParser when/if we optimise the text/string format // to load on a layer by layer basis -vector CaffeParserBase::GetInputs(const LayerParameter& layerParam) +vector ICaffeParser::CaffeParserImpl::GetInputs(const LayerParameter& layerParam) { std::vector ret; ret.reserve(armnn::numeric_cast(layerParam.bottom_size())); @@ -352,7 +391,7 @@ vector CaffeParserBase::GetInputs(const LayerParameter& l return ret; } -void CaffeParserBase::ParseInputLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseInputLayer(const LayerParameter& layerParam) { ARMNN_ASSERT(layerParam.type() == "Input"); ValidateNumInputsOutputs(layerParam, 0, 1); @@ -402,10 +441,10 @@ void CaffeParserBase::ParseInputLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), inputLayer->GetOutputSlot(0)); } -void CaffeParserBase::AddConvLayerWithSplits(const caffe::LayerParameter& layerParam, - const armnn::Convolution2dDescriptor& desc, - unsigned int kernelW, - unsigned int kernelH) +void ICaffeParser::CaffeParserImpl::AddConvLayerWithSplits(const caffe::LayerParameter& layerParam, + const armnn::Convolution2dDescriptor& desc, + unsigned int kernelW, + unsigned int kernelH) { ARMNN_ASSERT(layerParam.type() == "Convolution"); ValidateNumInputsOutputs(layerParam, 1, 1); @@ -592,10 +631,10 @@ void CaffeParserBase::AddConvLayerWithSplits(const caffe::LayerParameter& layerP SetArmnnOutputSlotForCaffeTop(layerParam.top(0), concatLayer->GetOutputSlot(0)); } -void CaffeParserBase::AddDeconvLayerWithSplits(const caffe::LayerParameter& layerParam, - const armnn::TransposeConvolution2dDescriptor& desc, - unsigned int kernelW, - unsigned int kernelH) +void ICaffeParser::CaffeParserImpl::AddDeconvLayerWithSplits(const caffe::LayerParameter& layerParam, + const armnn::TransposeConvolution2dDescriptor& desc, + unsigned int kernelW, + unsigned int kernelH) { ARMNN_ASSERT(layerParam.type() == "Deconvolution"); ValidateNumInputsOutputs(layerParam, 1, 1); @@ -780,10 +819,10 @@ void CaffeParserBase::AddDeconvLayerWithSplits(const caffe::LayerParameter& laye SetArmnnOutputSlotForCaffeTop(layerParam.top(0), concatLayer->GetOutputSlot(0)); } -void CaffeParserBase::AddConvLayerWithDepthwiseConv(const caffe::LayerParameter& layerParam, - const armnn::Convolution2dDescriptor& convDesc, - unsigned int kernelW, - unsigned int kernelH) +void ICaffeParser::CaffeParserImpl::AddConvLayerWithDepthwiseConv(const caffe::LayerParameter& layerParam, + const armnn::Convolution2dDescriptor& convDesc, + unsigned int kernelW, + unsigned int kernelH) { ARMNN_ASSERT(layerParam.type() == "Convolution"); ValidateNumInputsOutputs(layerParam, 1, 1); @@ -870,7 +909,7 @@ void CaffeParserBase::AddConvLayerWithDepthwiseConv(const caffe::LayerParameter& SetArmnnOutputSlotForCaffeTop(layerParam.top(0), returnLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseConvLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseConvLayer(const LayerParameter& layerParam) { // Ignored Caffe Parameters // * Weight Filler @@ -1049,7 +1088,7 @@ void CaffeParserBase::ParseConvLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), returnLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseDeconvLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseDeconvLayer(const LayerParameter& layerParam) { // Ignored Caffe Parameters // * Weight Filler @@ -1225,7 +1264,7 @@ void CaffeParserBase::ParseDeconvLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), returnLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParsePoolingLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParsePoolingLayer(const LayerParameter& layerParam) { // Ignored Caffe Parameters // Stochastic Pooling @@ -1337,7 +1376,7 @@ void CaffeParserBase::ParsePoolingLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), poolingLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseArgmaxLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseArgmaxLayer(const LayerParameter& layerParam) { ValidateNumInputsOutputs(layerParam, 1, 1); ArgMaxParameter param = layerParam.argmax_param(); @@ -1397,7 +1436,7 @@ void CaffeParserBase::ParseArgmaxLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), argmaxLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseReluLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseReluLayer(const LayerParameter& layerParam) { ValidateNumInputsOutputs(layerParam, 1, 1); @@ -1423,7 +1462,7 @@ void CaffeParserBase::ParseReluLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), activationLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseLRNLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseLRNLayer(const LayerParameter& layerParam) { ValidateNumInputsOutputs(layerParam, 1, 1); @@ -1522,7 +1561,7 @@ void CaffeParserBase::ParseLRNLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), normLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseInnerProductLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseInnerProductLayer(const LayerParameter& layerParam) { InnerProductParameter param = layerParam.inner_product_param(); @@ -1596,7 +1635,7 @@ void CaffeParserBase::ParseInnerProductLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), fullyConnectedLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseSoftmaxLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseSoftmaxLayer(const LayerParameter& layerParam) { ValidateNumInputsOutputs(layerParam, 1, 1); @@ -1618,7 +1657,7 @@ void CaffeParserBase::ParseSoftmaxLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), softmaxLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseEltwiseLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseEltwiseLayer(const LayerParameter& layerParam) { ValidateNumInputsOutputs(layerParam, 2, 1); @@ -1663,7 +1702,7 @@ void CaffeParserBase::ParseEltwiseLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), newLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseConcatLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseConcatLayer(const LayerParameter& layerParam) { unsigned int numInputs = static_cast(layerParam.bottom_size()); // We assume concat happens along the channel dimension, which is 1 in (0, 1, 2, 3). @@ -1722,7 +1761,7 @@ void CaffeParserBase::ParseConcatLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), concatlayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseBatchNormLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseBatchNormLayer(const LayerParameter& layerParam) { ValidateNumInputsOutputs(layerParam, 1, 1); @@ -1786,7 +1825,7 @@ void CaffeParserBase::ParseBatchNormLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), batchNormLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseScaleLayer(const LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseScaleLayer(const LayerParameter& layerParam) { // Current unoptimal solution: add a batchnormalization layer with 0 mean and 1 variance. ValidateNumInputsOutputs(layerParam, 1, 1); @@ -1836,7 +1875,7 @@ void CaffeParserBase::ParseScaleLayer(const LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), batchNormLayer->GetOutputSlot(0)); } -void CaffeParserBase::ParseSplitLayer(const caffe::LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseSplitLayer(const caffe::LayerParameter& layerParam) { // Used in caffe to duplicate memory - not necessary in armnn. if (layerParam.bottom_size() != 1) @@ -1855,7 +1894,7 @@ void CaffeParserBase::ParseSplitLayer(const caffe::LayerParameter& layerParam) } } -void CaffeParserBase::ParseDropoutLayer(const caffe::LayerParameter& layerParam) +void ICaffeParser::CaffeParserImpl::ParseDropoutLayer(const caffe::LayerParameter& layerParam) { // Ignored for inference, so patch the single input to its single output. if (layerParam.bottom_size() != 1 || layerParam.top_size() != 1) @@ -1871,21 +1910,21 @@ void CaffeParserBase::ParseDropoutLayer(const caffe::LayerParameter& layerParam) SetArmnnOutputSlotForCaffeTop(layerParam.top(0), GetArmnnOutputSlotForCaffeTop(layerParam.bottom(0))); } -void CaffeParserBase::TrackInputBinding(armnn::IConnectableLayer* layer, +void ICaffeParser::CaffeParserImpl::TrackInputBinding(armnn::IConnectableLayer* layer, armnn::LayerBindingId id, const armnn::TensorInfo& tensorInfo) { return TrackBindingPoint(layer, id, tensorInfo, layer->GetName(), m_NetworkInputsBindingInfo); } -void CaffeParserBase::TrackOutputBinding(armnn::IConnectableLayer* layer, +void ICaffeParser::CaffeParserImpl::TrackOutputBinding(armnn::IConnectableLayer* layer, armnn::LayerBindingId id, const armnn::TensorInfo& tensorInfo) { return TrackBindingPoint(layer, id, tensorInfo, layer->GetName(), m_NetworkOutputsBindingInfo); } -void CaffeParserBase::TrackBindingPoint(armnn::IConnectableLayer* layer, +void ICaffeParser::CaffeParserImpl::TrackBindingPoint(armnn::IConnectableLayer* layer, armnn::LayerBindingId id, const armnn::TensorInfo& tensorInfo, const char* bindingPointDesc, @@ -1907,7 +1946,7 @@ void CaffeParserBase::TrackBindingPoint(armnn::IConnectableLayer* layer, } } -armnn::IOutputSlot& CaffeParserBase::GetArmnnOutputSlotForCaffeTop(const std::string& caffeTopName) const +armnn::IOutputSlot& ICaffeParser::CaffeParserImpl::GetArmnnOutputSlotForCaffeTop(const std::string& caffeTopName) const { auto it = m_ArmnnOutputSlotForCaffeTop.find(caffeTopName); if (it != m_ArmnnOutputSlotForCaffeTop.end()) @@ -1923,7 +1962,7 @@ armnn::IOutputSlot& CaffeParserBase::GetArmnnOutputSlotForCaffeTop(const std::st } } -void CaffeParserBase::SetArmnnOutputSlotForCaffeTop( +void ICaffeParser::CaffeParserImpl::SetArmnnOutputSlotForCaffeTop( const std::string& caffeTopName, armnn::IOutputSlot& armnnOutputSlot) { auto it = m_ArmnnOutputSlotForCaffeTop.find(caffeTopName); @@ -1942,7 +1981,7 @@ void CaffeParserBase::SetArmnnOutputSlotForCaffeTop( // Note: can move to CaffeParser when/if we optimise the text/string format // to load on a layer by layer basis -void CaffeParserBase::ResolveInPlaceLayers(caffe::NetParameter& netParameter) +void ICaffeParser::CaffeParserImpl::ResolveInPlaceLayers(caffe::NetParameter& netParameter) { // Finds layers with the same top. std::map> layersByTop; @@ -1998,7 +2037,7 @@ void CaffeParserBase::ResolveInPlaceLayers(caffe::NetParameter& netParameter) // Note: can move to CaffeParser when/if we optimise the text/string format // to load on a layer by layer basis -void CaffeParserBase::LoadNetParam(NetParameter& netParameter) +void ICaffeParser::CaffeParserImpl::LoadNetParam(NetParameter& netParameter) { // Caffe models sometimes have an implicit input layer. // In that case, add an explicit one. @@ -2094,7 +2133,7 @@ void CaffeParserBase::LoadNetParam(NetParameter& netParameter) } } -INetworkPtr CaffeParserBase::CreateNetworkFromTextFile(const char* graphFile, +INetworkPtr ICaffeParser::CaffeParserImpl::CreateNetworkFromTextFile(const char* graphFile, const std::map& inputShapes, const std::vector& requestedOutputs) { @@ -2126,7 +2165,7 @@ INetworkPtr CaffeParserBase::CreateNetworkFromTextFile(const char* graphFile, return CreateNetworkFromNetParameter(netParam, inputShapes, requestedOutputs); } -INetworkPtr CaffeParserBase::CreateNetworkFromString(const char* protoText, +INetworkPtr ICaffeParser::CaffeParserImpl::CreateNetworkFromString(const char* protoText, const std::map& inputShapes, const std::vector& requestedOutputs) { @@ -2180,7 +2219,7 @@ INetworkPtr CaffeParser::CreateNetworkFromBinaryFile(const char* graphFile, // Note: can move to CaffeParser when/if we optimise the text/string format // to load on a layer by layer basis -INetworkPtr CaffeParserBase::CreateNetworkFromNetParameter(NetParameter& netParam, +INetworkPtr ICaffeParser::CaffeParserImpl::CreateNetworkFromNetParameter(NetParameter& netParam, const std::map& inputShapes, const std::vector& requestedOutputs) { @@ -2211,7 +2250,7 @@ INetworkPtr CaffeParserBase::CreateNetworkFromNetParameter(NetParameter& netPara return move(m_Network); } -void CaffeParserBase::Cleanup() { +void ICaffeParser::CaffeParserImpl::Cleanup() { // cleanup, in case we reuse this parser m_InputShapes.clear(); m_RequestedOutputs.clear(); diff --git a/src/armnnCaffeParser/CaffeParser.hpp b/src/armnnCaffeParser/CaffeParser.hpp index 98eeffc6a1..f369d5f2f9 100644 --- a/src/armnnCaffeParser/CaffeParser.hpp +++ b/src/armnnCaffeParser/CaffeParser.hpp @@ -23,32 +23,39 @@ class NetParameter; namespace armnnCaffeParser { -class CaffeParserBase: public ICaffeParser +class ICaffeParser::CaffeParserImpl { public: // Because we haven't looked at reducing the memory usage when loading from Text/String // have to retain these functions here for the moment. /// Create the network from a protobuf text file on disk - virtual armnn::INetworkPtr CreateNetworkFromTextFile( + armnn::INetworkPtr CreateNetworkFromTextFile( const char* graphFile, const std::map& inputShapes, - const std::vector& requestedOutputs) override; + const std::vector& requestedOutputs); + + /// Create the network from a protobuf binary file on the disk. + virtual armnn::INetworkPtr CreateNetworkFromBinaryFile( + const char* graphFile, + const std::map& inputShapes, + const std::vector& requestedOutputs) = 0; /// Creates the network directly from protobuf text in a string. Useful for debugging/testing. - virtual armnn::INetworkPtr CreateNetworkFromString( + armnn::INetworkPtr CreateNetworkFromString( const char* protoText, const std::map& inputShapes, - const std::vector& requestedOutputs) override; + const std::vector& requestedOutputs); /// Retrieves binding info (layer id and tensor info) for the network input identified by the given layer name. - virtual BindingPointInfo GetNetworkInputBindingInfo(const std::string& name) const override; + BindingPointInfo GetNetworkInputBindingInfo(const std::string& name) const; /// Retrieves binding info (layer id and tensor info) for the network output identified by the given layer name. - virtual BindingPointInfo GetNetworkOutputBindingInfo(const std::string& name) const override; + BindingPointInfo GetNetworkOutputBindingInfo(const std::string& name) const; - CaffeParserBase(); + CaffeParserImpl(); + virtual ~CaffeParserImpl() = default; protected: /// Adds an armnn layer to m_Network given a Caffe LayerParameter of the correct type @@ -118,7 +125,7 @@ protected: void Cleanup(); - using OperationParsingFunction = void(CaffeParserBase::*)(const caffe::LayerParameter& layerParam); + using OperationParsingFunction = void(CaffeParserImpl::*)(const caffe::LayerParameter& layerParam); /// Maps Caffe layer names to parsing member functions. static const std::map ms_CaffeLayerNameToParsingFunctions; @@ -162,7 +169,7 @@ protected: }; -class CaffeParser : public CaffeParserBase +class CaffeParser : public ICaffeParser::CaffeParserImpl { public: diff --git a/src/armnnCaffeParser/RecordByRecordCaffeParser.cpp b/src/armnnCaffeParser/RecordByRecordCaffeParser.cpp index a59725cbd2..b7ff3d8731 100644 --- a/src/armnnCaffeParser/RecordByRecordCaffeParser.cpp +++ b/src/armnnCaffeParser/RecordByRecordCaffeParser.cpp @@ -456,7 +456,7 @@ void ResolveInPlaceLayers(std::vector& layerInfo) } // anonymous namespace, can't be seen outside this source file -RecordByRecordCaffeParser::RecordByRecordCaffeParser() : CaffeParserBase() +RecordByRecordCaffeParser::RecordByRecordCaffeParser() : CaffeParserImpl() {} armnn::INetworkPtr RecordByRecordCaffeParser::CreateNetworkFromBinaryFile( diff --git a/src/armnnCaffeParser/RecordByRecordCaffeParser.hpp b/src/armnnCaffeParser/RecordByRecordCaffeParser.hpp index 361d6f428d..aab2fb025b 100644 --- a/src/armnnCaffeParser/RecordByRecordCaffeParser.hpp +++ b/src/armnnCaffeParser/RecordByRecordCaffeParser.hpp @@ -22,7 +22,7 @@ class NetParameterInfo; class LayerParameterInfo; -class RecordByRecordCaffeParser : public CaffeParserBase +class RecordByRecordCaffeParser : public ICaffeParser::CaffeParserImpl { public: -- cgit v1.2.1