Go to the documentation of this file.
30 namespace InferenceEngine {
35 class INFERENCE_ENGINE_API_CLASS(CNNNetwork) {
47 explicit CNNNetwork(std::shared_ptr<ICNNNetwork> network): network(network) {
48 actual = network.get();
58 explicit CNNNetwork(
const std::shared_ptr<ngraph::Function>& network);
75 actual->getOutputsInfo(outputs);
89 actual->getInputsInfo(inputs);
102 return actual->layerCount();
114 return actual->getName();
126 CALL_STATUS_FNC(setBatchSize, size);
138 return actual->getBatchSize();
177 return actual->getFunction();
187 return actual->getFunction();
198 void addOutput(
const std::string& layerName,
size_t outputIndex = 0) {
199 CALL_STATUS_FNC(addOutput, layerName, outputIndex);
211 actual->getInputsInfo(inputs);
212 for (
const auto& pair : inputs) {
213 auto info = pair.second;
215 auto data = info->getInputData();
217 shapes[data->getName()] = data->getTensorDesc().getDims();
230 CALL_STATUS_FNC(reshape, inputShapes);
240 void serialize(
const std::string& xmlPath,
const std::string& binPath =
"")
const {
241 CALL_STATUS_FNC(serialize, xmlPath, binPath);
A header file that provides macros to handle no exception methods.
std::map< std::string, SizeVector > InputShapes
Map of pairs: name of corresponding data and its dimension.
Definition: ie_icnn_network.hpp:147
This is a header file for the ICNNNetwork class.
size_t layerCount() const
Returns the number of layers in the network as an integer value.
Definition: ie_cnn_network.h:100
virtual ~CNNNetwork()
A destructor.
Definition: ie_cnn_network.h:63
virtual InputsDataMap getInputsInfo() const
Gets the network input Data node information. The received info is stored in the given InputsDataMap ...
Definition: ie_cnn_network.h:86
virtual void reshape(const ICNNNetwork::InputShapes &inputShapes)
Run shape inference with new input shapes for the network.
Definition: ie_cnn_network.h:229
A header file for Blob and generic TBlob<>
virtual ICNNNetwork::InputShapes getInputShapes() const
Helper method to get collect all input shapes with names of corresponding Data objects.
Definition: ie_cnn_network.h:207
This header file defines the main Data representation node.
This is the main interface to describe the NN topology.
Definition: ie_icnn_network.hpp:39
void addOutput(const std::string &layerName, size_t outputIndex=0)
Adds output to the layer.
Definition: ie_cnn_network.h:198
std::shared_ptr< ngraph::Function > getFunction()
Returns constant nGraph function.
Definition: ie_cnn_network.h:175
std::shared_ptr< ICNNNetwork > network
Network extra interface, might be nullptr.
Definition: ie_cnn_network.h:248
virtual size_t getBatchSize() const
Gets the inference batch size.
Definition: ie_cnn_network.h:136
virtual OutputsDataMap getOutputsInfo() const
Gets the network output Data node information. The received info is stored in the given Data node.
Definition: ie_cnn_network.h:72
DataPtr output
A pointer to output data.
Definition: ie_cnn_network.h:257
This is a header file with common inference engine definitions.
CNNNetwork(const std::shared_ptr< ngraph::Function > &network)
A constructor from ngraph::Function object This constructor wraps existing ngraph::Function If you wa...
void serialize(const std::string &xmlPath, const std::string &binPath="") const
Serialize network to IR and weights files.
Definition: ie_cnn_network.h:240
const std::string & getName() const
Returns the network name.
Definition: ie_cnn_network.h:112
#define THROW_IE_EXCEPTION
A macro used to throw the exception with a notable description.
Definition: ie_exception.hpp:25
virtual void setBatchSize(const size_t size)
Changes the inference batch size.
Definition: ie_cnn_network.h:125
std::shared_ptr< Data > DataPtr
Smart pointer to Data.
Definition: ie_common.h:37
std::shared_ptr< ICNNNetwork > Ptr
A shared pointer to a ICNNNetwork interface.
Definition: ie_icnn_network.hpp:44
CNNNetwork(std::shared_ptr< ICNNNetwork > network)
Allows helper class to manage lifetime of network object.
Definition: ie_cnn_network.h:47
std::shared_ptr< const ngraph::Function > getFunction() const
Returns constant nGraph function.
Definition: ie_cnn_network.h:185
std::map< std::string, DataPtr > OutputsDataMap
A collection that contains string as key, and Data smart pointer as value.
Definition: ie_icnn_network.hpp:33
CNNNetwork()=default
A default constructor.