31 namespace InferenceEngine {
36 class INFERENCE_ENGINE_API_CLASS(CNNNetwork) {
48 explicit CNNNetwork(std::shared_ptr<ICNNNetwork> network): network(network) {
49 actual = network.get();
60 explicit CNNNetwork(
const std::shared_ptr<ngraph::Function>& network,
61 const std::vector<IExtensionPtr>& exts = {});
78 actual->getOutputsInfo(outputs);
92 actual->getInputsInfo(inputs);
105 return actual->layerCount();
117 return actual->getName();
128 CALL_STATUS_FNC(setBatchSize, size);
140 return actual->getBatchSize();
179 return actual->getFunction();
189 return actual->getFunction();
200 void addOutput(
const std::string& layerName,
size_t outputIndex = 0) {
201 CALL_STATUS_FNC(addOutput, layerName, outputIndex);
213 actual->getInputsInfo(inputs);
214 for (
const auto& pair : inputs) {
215 auto info = pair.second;
217 auto data = info->getInputData();
219 shapes[data->getName()] = data->getTensorDesc().getDims();
232 CALL_STATUS_FNC(reshape, inputShapes);
242 void serialize(
const std::string& xmlPath,
const std::string& binPath =
"")
const {
243 CALL_STATUS_FNC(serialize, xmlPath, binPath);
std::shared_ptr< ICNNNetwork > network
Network extra interface, might be nullptr.
Definition: ie_cnn_network.h:250
CNNNetwork(const std::shared_ptr< ngraph::Function > &network, const std::vector< IExtensionPtr > &exts={})
A constructor from ngraph::Function object This constructor wraps existing ngraph::Function If you wa...
std::shared_ptr< const ngraph::Function > getFunction() const
Returns constant nGraph function.
Definition: ie_cnn_network.h:187
virtual size_t getBatchSize() const
Gets the inference batch size.
Definition: ie_cnn_network.h:138
virtual void reshape(const ICNNNetwork::InputShapes &inputShapes)
Run shape inference with new input shapes for the network.
Definition: ie_cnn_network.h:231
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:75
virtual void setBatchSize(const size_t size)
Changes the inference batch size.
Definition: ie_cnn_network.h:127
size_t layerCount() const
Returns the number of layers in the network as an integer value.
Definition: ie_cnn_network.h:103
CNNNetwork(std::shared_ptr< ICNNNetwork > network)
Allows helper class to manage lifetime of network object.
Definition: ie_cnn_network.h:48
std::shared_ptr< ngraph::Function > getFunction()
Returns constant nGraph function.
Definition: ie_cnn_network.h:177
DataPtr output
A pointer to output data.
Definition: ie_cnn_network.h:259
virtual ~CNNNetwork()
A destructor.
Definition: ie_cnn_network.h:66
void addOutput(const std::string &layerName, size_t outputIndex=0)
Adds output to the layer.
Definition: ie_cnn_network.h:200
const std::string & getName() const
Returns the network name.
Definition: ie_cnn_network.h:115
CNNNetwork()=default
A default constructor.
virtual ICNNNetwork::InputShapes getInputShapes() const
Helper method to get collect all input shapes with names of corresponding Data objects.
Definition: ie_cnn_network.h:209
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:89
void serialize(const std::string &xmlPath, const std::string &binPath="") const
Serialize network to IR and weights files.
Definition: ie_cnn_network.h:242
This is the main interface to describe the NN topology.
Definition: ie_icnn_network.hpp:39
std::shared_ptr< ICNNNetwork > Ptr
A shared pointer to a ICNNNetwork interface.
Definition: ie_icnn_network.hpp:44
std::map< std::string, SizeVector > InputShapes
Map of pairs: name of corresponding data and its dimension.
Definition: ie_icnn_network.hpp:147
A header file for Blob and generic TBlob<>
This is a header file with common inference engine definitions.
std::shared_ptr< Data > DataPtr
Smart pointer to Data.
Definition: ie_common.h:37
This header file defines the main Data representation node.
#define THROW_IE_EXCEPTION
A macro used to throw the exception with a notable description.
Definition: ie_exception.hpp:25
A header file that provides macros to handle no exception methods.
A header file that defines a wrapper class for handling extension instantiation and releasing resourc...
This is a header file for the ICNNNetwork class.
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