surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 4 | // |
| 5 | #pragma once |
| 6 | |
| 7 | #include "armnnTfParser/ITfParser.hpp" |
| 8 | |
| 9 | #include "armnn/Types.hpp" |
| 10 | #include "armnn/Tensor.hpp" |
| 11 | #include "armnn/INetwork.hpp" |
| 12 | |
narpra01 | 6f37f83 | 2018-12-21 18:30:00 +0000 | [diff] [blame] | 13 | #include <list> |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 14 | #include <map> |
| 15 | #include <memory> |
| 16 | #include <unordered_map> |
jimfly01 | 84c70e6 | 2018-12-19 13:14:46 +0000 | [diff] [blame] | 17 | #include <utility> |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 18 | #include <vector> |
| 19 | |
| 20 | namespace armnn |
| 21 | { |
| 22 | class TensorInfo; |
| 23 | } |
| 24 | |
| 25 | namespace tensorflow |
| 26 | { |
| 27 | class GraphDef; |
| 28 | class NodeDef; |
| 29 | } |
| 30 | |
| 31 | namespace armnnTfParser |
| 32 | { |
| 33 | |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 34 | class ParsedTfOperation; |
| 35 | using ParsedTfOperationPtr = std::unique_ptr<ParsedTfOperation>; |
| 36 | |
| 37 | /// |
| 38 | /// WithOutputTensorIndex wraps a value and an index. The purpose of |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 39 | /// this template is to signify that, in Tensorflow, the input name of |
| 40 | /// a layer has the convention of 'inputTensorName:#index', where the |
| 41 | /// #index can be omitted and it implicitly means the 0 output of |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 42 | /// the referenced layer. By supporting this notation we can handle |
| 43 | /// layers with multiple outputs, such as Split. |
| 44 | /// |
| 45 | template <typename T> |
| 46 | struct WithOutputTensorIndex |
| 47 | { |
| 48 | T m_IndexedValue; |
| 49 | unsigned int m_Index; |
| 50 | |
| 51 | WithOutputTensorIndex(const T & value, unsigned int index) |
| 52 | : m_IndexedValue{value} |
| 53 | , m_Index{index} {} |
| 54 | |
| 55 | WithOutputTensorIndex(T && value, unsigned int index) |
| 56 | : m_IndexedValue{value} |
| 57 | , m_Index{index} {} |
| 58 | }; |
| 59 | |
| 60 | using OutputOfParsedTfOperation = WithOutputTensorIndex<ParsedTfOperation *>; |
| 61 | using OutputOfConstNodeDef = WithOutputTensorIndex<const tensorflow::NodeDef*>; |
| 62 | using OutputId = WithOutputTensorIndex<std::string>; |
| 63 | |
| 64 | class TfParser : public ITfParser |
| 65 | { |
| 66 | public: |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 67 | /// Creates the network from a protobuf text file on the disk. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 68 | virtual armnn::INetworkPtr CreateNetworkFromTextFile( |
| 69 | const char* graphFile, |
| 70 | const std::map<std::string, armnn::TensorShape>& inputShapes, |
| 71 | const std::vector<std::string>& requestedOutputs) override; |
| 72 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 73 | /// Creates the network from a protobuf binary file on the disk. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 74 | virtual armnn::INetworkPtr CreateNetworkFromBinaryFile( |
| 75 | const char* graphFile, |
| 76 | const std::map<std::string, armnn::TensorShape>& inputShapes, |
| 77 | const std::vector<std::string>& requestedOutputs) override; |
| 78 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 79 | /// Creates the network directly from protobuf text in a string. Useful for debugging/testing. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 80 | virtual armnn::INetworkPtr CreateNetworkFromString( |
| 81 | const char* protoText, |
| 82 | const std::map<std::string, armnn::TensorShape>& inputShapes, |
| 83 | const std::vector<std::string>& requestedOutputs) override; |
| 84 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 85 | /// Retrieves binding info (layer id and tensor info) for the network input identified by the given layer name. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 86 | virtual BindingPointInfo GetNetworkInputBindingInfo(const std::string& name) const override; |
| 87 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 88 | /// Retrieves binding info (layer id and tensor info) for the network output identified by the given layer name. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 89 | virtual BindingPointInfo GetNetworkOutputBindingInfo(const std::string& name) const override; |
| 90 | |
| 91 | public: |
| 92 | TfParser(); |
| 93 | |
| 94 | private: |
| 95 | template <typename T> |
| 96 | friend class ParsedConstTfOperation; |
| 97 | friend class ParsedMatMulTfOperation; |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 98 | friend class ParsedMulTfOperation; |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 99 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 100 | /// Parses a GraphDef loaded into memory from one of the other CreateNetwork*. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 101 | armnn::INetworkPtr CreateNetworkFromGraphDef(const tensorflow::GraphDef& graphDef, |
| 102 | const std::map<std::string, armnn::TensorShape>& inputShapes, |
| 103 | const std::vector<std::string>& requestedOutputs); |
| 104 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 105 | /// Sets up variables and then performs BFS to parse all nodes. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 106 | void LoadGraphDef(const tensorflow::GraphDef& graphDef); |
| 107 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 108 | /// Parses a given node, assuming nodes before it in the graph have been done. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 109 | void LoadNodeDef(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 110 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 111 | /// Handling identity layers as the input for Conv2D layer. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 112 | const tensorflow::NodeDef* ResolveIdentityNode(const tensorflow::NodeDef* nodeDef); |
| 113 | /// Finds the nodes connected as inputs of the given node in the graph. |
| 114 | std::vector<OutputOfConstNodeDef> GetTfInputNodes(const tensorflow::NodeDef& nodeDef) const; |
| 115 | /// Finds the IParsedTfOperations for the nodes connected as inputs of the given node in the graph, |
| 116 | /// and throws an exception if the number of inputs does not match the expected one. |
| 117 | /// This will automatically resolve any identity nodes. The result vector contains the parsed operation |
| 118 | /// together with the output tensor index to make the connection unambiguous. |
| 119 | std::vector<OutputOfParsedTfOperation> GetInputParsedTfOperationsChecked(const tensorflow::NodeDef& nodeDef, |
| 120 | std::size_t expectedNumInputs); |
| 121 | |
| 122 | ParsedTfOperationPtr ParseConst(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 123 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 124 | /// Checks if there is a pre-parsed const tensor available with the given name and Type. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 125 | template<typename Type> |
| 126 | bool HasParsedConstTensor(const std::string & nodeName) const; |
jimfly01 | f6ba747 | 2018-12-04 10:09:52 +0000 | [diff] [blame] | 127 | template<typename Type> |
| 128 | bool HasParsedConstTensor(ParsedTfOperation* parsedTfOpPtr) const; |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 129 | |
Saoirse Stewart | 91c0eff | 2019-02-27 11:07:57 +0000 | [diff] [blame] | 130 | unsigned int GetConstInputIndex(const std::vector<OutputOfParsedTfOperation>& inputs); |
| 131 | |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 132 | ParsedTfOperationPtr ParseAdd(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
Ferran Balaguer | fbdad03 | 2018-12-28 18:15:24 +0000 | [diff] [blame] | 133 | ParsedTfOperationPtr ParseAddN(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 134 | ParsedTfOperationPtr ParseBiasAdd(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 135 | ParsedTfOperationPtr ParseConv2D(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
Jim Flynn | 6cde7ed | 2019-02-20 14:25:11 +0000 | [diff] [blame] | 136 | ParsedTfOperationPtr ParseDepthwiseConv2D(const tensorflow::NodeDef& nodeDef, |
| 137 | const tensorflow::GraphDef& graphDef); |
| 138 | ParsedTfOperationPtr ParseExpandDims(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 139 | ParsedTfOperationPtr ParseFusedBatchNorm(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 140 | ParsedTfOperationPtr ParseConcat(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 141 | ParsedTfOperationPtr ParseIdentity(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 142 | ParsedTfOperationPtr ParseLrn(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 143 | ParsedTfOperationPtr ParseMatMul(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
Ferran Balaguer | 51dd62f | 2019-01-11 19:29:18 +0000 | [diff] [blame] | 144 | ParsedTfOperationPtr ParseMean(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 145 | ParsedTfOperationPtr ParseMul(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 146 | ParsedTfOperationPtr ParsePlaceholder(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
saoste01 | bbd4061 | 2018-08-28 15:41:51 +0100 | [diff] [blame] | 147 | ParsedTfOperationPtr ParseRealDiv(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 148 | ParsedTfOperationPtr ParseRelu(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 149 | ParsedTfOperationPtr ParseRelu6(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 150 | ParsedTfOperationPtr ParseReshape(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 151 | ParsedTfOperationPtr ParseResizeBilinear(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
Mohamed Nour Abouelseoud | 7a8892f | 2019-01-09 14:19:58 +0000 | [diff] [blame] | 152 | ParsedTfOperationPtr ParseRsqrt(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 153 | ParsedTfOperationPtr ParseShape(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 154 | ParsedTfOperationPtr ParseSqueeze(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 155 | ParsedTfOperationPtr ParseSigmoid(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 156 | ParsedTfOperationPtr ParseSoftmax(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 157 | ParsedTfOperationPtr ParseSoftplus(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
Sadik Armagan | 2ad6cb4 | 2018-12-27 11:23:44 +0000 | [diff] [blame] | 158 | ParsedTfOperationPtr ParseSplit(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 159 | ParsedTfOperationPtr ParseTanh(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 160 | ParsedTfOperationPtr ParseMaxPool(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
| 161 | ParsedTfOperationPtr ParseAvgPool(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
Jim Flynn | 6cde7ed | 2019-02-20 14:25:11 +0000 | [diff] [blame] | 162 | ParsedTfOperationPtr ParsePooling2d(const tensorflow::NodeDef& nodeDef, |
| 163 | const tensorflow::GraphDef& graphDef, |
| 164 | armnn::PoolingAlgorithm pooltype); |
jimfly01 | 84c70e6 | 2018-12-19 13:14:46 +0000 | [diff] [blame] | 165 | ParsedTfOperationPtr ParseEqual(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 166 | ParsedTfOperationPtr ParseMaximum(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
Nattapat Chaimanowong | 24df822 | 2018-12-04 13:47:02 +0000 | [diff] [blame] | 167 | ParsedTfOperationPtr ParseMinimum(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
FrancisMurtagh | 94412af | 2019-01-24 10:53:39 +0000 | [diff] [blame] | 168 | ParsedTfOperationPtr ParseGather(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
jimfly01 | a06bf31 | 2018-12-18 16:24:51 +0000 | [diff] [blame] | 169 | ParsedTfOperationPtr ParseGreater(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
jimfly01 | f6ba747 | 2018-12-04 10:09:52 +0000 | [diff] [blame] | 170 | ParsedTfOperationPtr ParsePad(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
jimfly01 | 23be07e | 2018-12-04 17:47:22 +0000 | [diff] [blame] | 171 | ParsedTfOperationPtr ParseSub(const tensorflow::NodeDef& nodeDef, const tensorflow::GraphDef& graphDef); |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 172 | ParsedTfOperationPtr AddActivationLayer(const tensorflow::NodeDef& nodeDef, armnn::ActivationDescriptor& desc); |
| 173 | ParsedTfOperationPtr AddAdditionLayer(const tensorflow::NodeDef& nodeDef, bool isBiasAdd = false); |
saoste01 | bbd4061 | 2018-08-28 15:41:51 +0100 | [diff] [blame] | 174 | ParsedTfOperationPtr AddRealDivLayer(const tensorflow::NodeDef& nodeDef); |
Sadik Armagan | 975c09a | 2018-12-04 10:02:08 +0000 | [diff] [blame] | 175 | ParsedTfOperationPtr AddMaximumLayer(const tensorflow::NodeDef& nodeDef); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 176 | |
| 177 | private: |
| 178 | armnn::IConnectableLayer* AddMultiplicationLayer(const tensorflow::NodeDef& nodeDef); |
| 179 | |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 180 | armnn::IConnectableLayer* AddFullyConnectedLayer(const tensorflow::NodeDef& matMulNodeDef, |
| 181 | const tensorflow::NodeDef* addNodeDef, const char* armnnLayerName); |
| 182 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 183 | bool IsSupportedLeakyReluPattern(const tensorflow::NodeDef& mulNodeDef, |
| 184 | size_t alphaLayerIndex, |
| 185 | const OutputOfParsedTfOperation& otherOp, |
| 186 | armnn::IOutputSlot** outputOfLeakyRelu, |
| 187 | armnn::ActivationDescriptor & desc); |
| 188 | |
jimfly01 | 84c70e6 | 2018-12-19 13:14:46 +0000 | [diff] [blame] | 189 | std::pair<armnn::IOutputSlot*, armnn::IOutputSlot*> ProcessElementwiseInputSlots( |
| 190 | const tensorflow::NodeDef& nodeDef, const std::string& layerName); |
| 191 | |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 192 | ParsedTfOperationPtr ProcessComparisonLayer( |
| 193 | armnn::IOutputSlot* input0Slot, |
| 194 | armnn::IOutputSlot* input1Slot, |
| 195 | armnn::IConnectableLayer* const layer, |
| 196 | const tensorflow::NodeDef& nodeDef); |
| 197 | |
jimfly01 | 84c70e6 | 2018-12-19 13:14:46 +0000 | [diff] [blame] | 198 | ParsedTfOperationPtr ProcessElementwiseLayer( |
| 199 | armnn::IOutputSlot* input0Slot, |
| 200 | armnn::IOutputSlot* input1Slot, |
| 201 | armnn::IConnectableLayer* const layer, |
| 202 | const tensorflow::NodeDef& nodeDef); |
| 203 | |
Ferran Balaguer | fbdad03 | 2018-12-28 18:15:24 +0000 | [diff] [blame] | 204 | armnn::IConnectableLayer* CreateAdditionLayer( |
| 205 | const tensorflow::NodeDef& nodeDef, |
| 206 | armnn::IOutputSlot* input0Slot, |
| 207 | armnn::IOutputSlot* input1Slot, |
| 208 | const std::string& layerName); |
| 209 | |
| 210 | armnn::IConnectableLayer* CreateAdditionLayer( |
| 211 | const tensorflow::NodeDef& nodeDef, |
| 212 | const OutputOfParsedTfOperation& opOne, |
| 213 | const OutputOfParsedTfOperation& opTwo, |
| 214 | unsigned int numberOfAddition); |
| 215 | |
| 216 | armnn::IConnectableLayer* CreateAdditionLayer( |
| 217 | const tensorflow::NodeDef& nodeDef, |
| 218 | armnn::IConnectableLayer* layerOne, |
| 219 | armnn::IConnectableLayer* layerTwo, |
| 220 | unsigned int numberOfAddition, |
| 221 | unsigned long numberOfLayersToConnect, |
| 222 | bool isOdd); |
| 223 | |
| 224 | armnn::IConnectableLayer* CreateAdditionLayer( |
| 225 | const tensorflow::NodeDef& nodeDef, |
| 226 | const OutputOfParsedTfOperation& op, |
| 227 | armnn::IConnectableLayer* layer); |
| 228 | |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 229 | static std::pair<armnn::LayerBindingId, armnn::TensorInfo> GetBindingInfo(const std::string& layerName, |
| 230 | const char* bindingPointDesc, |
| 231 | const std::unordered_map<std::string, BindingPointInfo>& nameToBindingInfo); |
| 232 | |
| 233 | void TrackInputBinding(armnn::IConnectableLayer* layer, |
| 234 | armnn::LayerBindingId id, |
| 235 | const armnn::TensorInfo& tensorInfo); |
| 236 | |
| 237 | void TrackOutputBinding(armnn::IConnectableLayer* layer, |
| 238 | armnn::LayerBindingId id, |
| 239 | const armnn::TensorInfo& tensorInfo); |
| 240 | |
| 241 | static void TrackBindingPoint(armnn::IConnectableLayer* layer, armnn::LayerBindingId id, |
| 242 | const armnn::TensorInfo& tensorInfo, |
| 243 | const char* bindingPointDesc, |
| 244 | std::unordered_map<std::string, BindingPointInfo>& nameToBindingInfo); |
| 245 | |
| 246 | void Cleanup(); |
| 247 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 248 | /// The network we're building. Gets cleared after it is passed to the user. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 249 | armnn::INetworkPtr m_Network; |
| 250 | |
| 251 | using OperationParsingFunction = ParsedTfOperationPtr(TfParser::*)(const tensorflow::NodeDef& nodeDef, |
| 252 | const tensorflow::GraphDef& graphDef); |
| 253 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 254 | /// Map of TensorFlow operation names to parsing member functions. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 255 | static const std::map<std::string, OperationParsingFunction> ms_OperationNameToParsingFunctions; |
| 256 | |
narpra01 | 6f37f83 | 2018-12-21 18:30:00 +0000 | [diff] [blame] | 257 | static const std::list<std::string> m_ControlInputs; |
| 258 | |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 259 | std::map<std::string, armnn::TensorShape> m_InputShapes; |
| 260 | std::vector<std::string> m_RequestedOutputs; |
| 261 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 262 | /// Map of nodes extracted from the GraphDef to speed up parsing. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 263 | std::unordered_map<std::string, const tensorflow::NodeDef*> m_NodesByName; |
| 264 | |
| 265 | std::unordered_map<std::string, ParsedTfOperationPtr> m_ParsedTfOperations; |
| 266 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 267 | /// Maps input layer names to their corresponding ids and tensor info. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 268 | std::unordered_map<std::string, BindingPointInfo> m_NetworkInputsBindingInfo; |
| 269 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 270 | /// Maps output layer names to their corresponding ids and tensor info. |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 271 | std::unordered_map<std::string, BindingPointInfo> m_NetworkOutputsBindingInfo; |
| 272 | }; |
Ferran Balaguer | 51dd62f | 2019-01-11 19:29:18 +0000 | [diff] [blame] | 273 | |
surmeh01 | bceff2f | 2018-03-29 16:29:27 +0100 | [diff] [blame] | 274 | } |