ArmNN
 21.02
ICaffeParser.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include "armnn/Types.hpp"
8 #include "armnn/NetworkFwd.hpp"
9 #include "armnn/Tensor.hpp"
10 #include "armnn/INetwork.hpp"
11 
12 #include <memory>
13 #include <map>
14 #include <vector>
15 
17 {
18 
20 
21 class ICaffeParser;
22 using ICaffeParserPtr = std::unique_ptr<ICaffeParser, void(*)(ICaffeParser* parser)>;
23 
25 {
26 public:
27  static ICaffeParser* CreateRaw();
28  static ICaffeParserPtr Create();
29  static void Destroy(ICaffeParser* parser);
30 
31  /// Create the network from a protobuf text file on the disk.
33  const char* graphFile,
34  const std::map<std::string, armnn::TensorShape>& inputShapes,
35  const std::vector<std::string>& requestedOutputs);
36 
37  /// Create the network from a protobuf binary file on the disk.
39  const char* graphFile,
40  const std::map<std::string, armnn::TensorShape>& inputShapes,
41  const std::vector<std::string>& requestedOutputs);
42 
43  /// Create the network directly from protobuf text in a string. Useful for debugging/testin.g
45  const char* protoText,
46  const std::map<std::string, armnn::TensorShape>& inputShapes,
47  const std::vector<std::string>& requestedOutputs);
48 
49  /// Retrieve binding info (layer id and tensor info) for the network input identified by the given layer name.
50  BindingPointInfo GetNetworkInputBindingInfo(const std::string& name) const;
51 
52  /// Retrieve binding info (layer id and tensor info) for the network output identified by the given layer name.
53  BindingPointInfo GetNetworkOutputBindingInfo(const std::string& name) const;
54 
55 private:
56  friend class CaffeParser;
58 
59  ICaffeParser();
60  ~ICaffeParser();
61 
62  class CaffeParserImpl;
63  std::unique_ptr<CaffeParserImpl> pCaffeParserImpl;
64 };
65 
66 }
static void Destroy(ICaffeParser *parser)
Definition: CaffeParser.cpp:80
Caffe networks are loaded from protobuf files (binary or text) using the protobuf library and the gen...
armnn::INetworkPtr CreateNetworkFromBinaryFile(const char *graphFile, const std::map< std::string, armnn::TensorShape > &inputShapes, const std::vector< std::string > &requestedOutputs)
Create the network from a protobuf binary file on the disk.
Definition: CaffeParser.cpp:93
armnn::INetworkPtr CreateNetworkFromTextFile(const char *graphFile, const std::map< std::string, armnn::TensorShape > &inputShapes, const std::vector< std::string > &requestedOutputs)
Create the network from a protobuf text file on the disk.
Definition: CaffeParser.cpp:85
static ICaffeParserPtr Create()
Definition: CaffeParser.cpp:75
std::unique_ptr< ICaffeParser, void(*)(ICaffeParser *parser)> ICaffeParserPtr
BindingPointInfo GetNetworkInputBindingInfo(const std::string &name) const
Retrieve binding info (layer id and tensor info) for the network input identified by the given layer ...
std::pair< armnn::LayerBindingId, armnn::TensorInfo > BindingPointInfo
Definition: Tensor.hpp:261
static ICaffeParser * CreateRaw()
Definition: CaffeParser.cpp:70
armnn::INetworkPtr CreateNetworkFromString(const char *protoText, const std::map< std::string, armnn::TensorShape > &inputShapes, const std::vector< std::string > &requestedOutputs)
Create the network directly from protobuf text in a string. Useful for debugging/testin.g.
BindingPointInfo GetNetworkOutputBindingInfo(const std::string &name) const
Retrieve binding info (layer id and tensor info) for the network output identified by the given layer...
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:173