From 7d96b16acfdbdcef6739d59ba067a37c062aa03f Mon Sep 17 00:00:00 2001 From: Kevin May Date: Wed, 3 Feb 2021 17:38:41 +0000 Subject: IVGCVSW-5592 Implement Pimpl Idiom for Tf and TfLite Parsers Signed-off-by: Kevin May Change-Id: I4a82aca4a2c47b3c598b91bc0075c09397be728a --- src/armnnTfParser/TfParser.hpp | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'src/armnnTfParser/TfParser.hpp') diff --git a/src/armnnTfParser/TfParser.hpp b/src/armnnTfParser/TfParser.hpp index 94499ea52d..5c04cceb82 100644 --- a/src/armnnTfParser/TfParser.hpp +++ b/src/armnnTfParser/TfParser.hpp @@ -61,41 +61,38 @@ using OutputOfParsedTfOperation = WithOutputTensorIndex; using OutputOfConstNodeDef = WithOutputTensorIndex; using OutputId = WithOutputTensorIndex; -class TfParser : public ITfParser +struct ITfParser::TfParserImpl { public: /// Creates the network from a protobuf text file on the disk. - virtual armnn::INetworkPtr CreateNetworkFromTextFile( + armnn::INetworkPtr CreateNetworkFromTextFile( const char* graphFile, const std::map& inputShapes, - const std::vector& requestedOutputs) override; + const std::vector& requestedOutputs); /// Creates the network from a protobuf binary file on the disk. - virtual armnn::INetworkPtr CreateNetworkFromBinaryFile( + armnn::INetworkPtr CreateNetworkFromBinaryFile( const char* graphFile, const std::map& inputShapes, - const std::vector& requestedOutputs) override; + const std::vector& requestedOutputs); /// 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; -public: - TfParser(); + TfParserImpl(); + ~TfParserImpl() = default; -private: - template - friend class ParsedConstTfOperation; - friend class ParsedMatMulTfOperation; - friend class ParsedMulTfOperation; + TfParserImpl(const TfParserImpl&) = delete; + TfParserImpl& operator=(const TfParserImpl&) = delete; /// Parses a GraphDef loaded into memory from one of the other CreateNetwork*. armnn::INetworkPtr CreateNetworkFromGraphDef(const tensorflow::GraphDef& graphDef, @@ -177,7 +174,6 @@ private: ParsedTfOperationPtr AddRealDivLayer(const tensorflow::NodeDef& nodeDef); ParsedTfOperationPtr AddMaximumLayer(const tensorflow::NodeDef& nodeDef); -private: armnn::IConnectableLayer* AddMultiplicationLayer(const tensorflow::NodeDef& nodeDef); armnn::IConnectableLayer* AddFullyConnectedLayer(const tensorflow::NodeDef& matMulNodeDef, @@ -251,8 +247,8 @@ private: /// The network we're building. Gets cleared after it is passed to the user. armnn::INetworkPtr m_Network; - using OperationParsingFunction = ParsedTfOperationPtr(TfParser::*)(const tensorflow::NodeDef& nodeDef, - const tensorflow::GraphDef& graphDef); + using OperationParsingFunction = ParsedTfOperationPtr(TfParserImpl::*)(const tensorflow::NodeDef& nodeDef, + const tensorflow::GraphDef& graphDef); /// Map of TensorFlow operation names to parsing member functions. static const std::map ms_OperationNameToParsingFunctions; -- cgit v1.2.1