ie_iexecutable_network.hpp
Go to the documentation of this file.
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 /**
6  * @brief a header file for IExecutableNetwork interface
7  * @file ie_iexecutable_network.hpp
8  */
9 #pragma once
10 
11 #include "ie_common.h"
12 #include "ie_primitive_info.hpp"
13 #include "ie_iinfer_request.hpp"
14 #include "ie_icnn_network.hpp"
15 #include "ie_imemory_state.hpp"
16 #include "ie_input_info.hpp"
17 #include <string>
18 #include <vector>
19 #include <memory>
20 #include <map>
21 
22 namespace InferenceEngine {
23 
24 /**
25  * @brief A collection that contains string as key, and const Data smart pointer as value
26  */
27 using ConstOutputsDataMap = std::map<std::string, CDataPtr>;
28 
29 /**
30  * @brief This is an interface of an executable network
31  */
32 class IExecutableNetwork : public details::IRelease {
33 public:
34  /**
35  * @brief A smart pointer to the current IExecutableNetwork object
36  */
37  using Ptr = std::shared_ptr<IExecutableNetwork>;
38 
39  /**
40  * @brief Gets the Executable network output Data node information. The received info is stored in the given ConstOutputsDataMap node.
41  * This method need to be called to find output names for using them later during filling of a map
42  * of blobs passed to InferenceEngine::IInferencePlugin::Infer()
43  * @param out Reference to the ConstOutputsDataMap object
44  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
45  * @return Status code of the operation: OK (0) for success
46  */
47  virtual StatusCode GetOutputsInfo(ConstOutputsDataMap &out, ResponseDesc *resp) const noexcept = 0;
48 
49  /**
50  * @brief Gets the Executable network input Data node information. The received info is stored in the given ConstInputsDataMap object.
51  * This method need to be called to find out input names for using them later during filling of a map
52  * of blobs passed to InferenceEngine::IInferencePlugin::Infer()
53  * @param inputs Reference to ConstInputsDataMap object.
54  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
55  * @return Status code of the operation: OK (0) for success
56  */
57  virtual StatusCode GetInputsInfo(ConstInputsDataMap &inputs, ResponseDesc *resp) const noexcept = 0;
58 
59  /**
60  * @brief Creates an inference request object used to infer the network.
61  * The created request has allocated input and output blobs (that can be changed later).
62  * @param req Shared pointer to the created request object
63  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
64  * @return Status code of the operation: OK (0) for success
65  */
66  virtual StatusCode CreateInferRequest(IInferRequest::Ptr& req, ResponseDesc *resp) noexcept = 0;
67 
68  /**
69  * @brief Exports the current executable network so it can be used later in the Import() main API
70  * @param modelFileName Full path to the location of the exported file
71  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
72  * @return Status code of the operation: OK (0) for success
73  */
74  virtual StatusCode Export(const std::string& modelFileName, ResponseDesc *resp) noexcept = 0;
75 
76  /**
77  * @brief Get the mapping of IR layer names to implemented kernels
78  * @param deployedTopology Map of PrimitiveInfo objects that represent the deployed topology
79  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
80  * @return Status code of the operation: OK (0) for success
81  */
82  virtual StatusCode GetMappedTopology(std::map<std::string, std::vector<PrimitiveInfo::Ptr>> &deployedTopology, ResponseDesc *resp) noexcept = 0;
83 
84  /**
85  * @brief Get executable graph information from a device
86  * @param graphPtr network ptr to store executable graph information
87  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
88  * @return Status code of the operation: OK (0) for success
89  */
90  virtual StatusCode GetExecGraphInfo(ICNNNetwork::Ptr &graphPtr, ResponseDesc *resp) noexcept = 0;
91 
92  /**
93  * @brief Gets state control interface for given executable network, State control essential for recurrent networks
94  * @param pState reference to a pointer that receives internal states
95  * @param idx requested index for receiving memory state
96  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
97  * @return Status code of the operation: OK (0) for success, OUT_OF_BOUNDS (-6) no memory state for given index
98  */
99  virtual StatusCode QueryState(IMemoryState::Ptr & pState, size_t idx, ResponseDesc *resp) noexcept = 0;
100 };
101 
102 } // namespace InferenceEngine
Definition: ie_argmax_layer.hpp:11
StatusCode
This enum contains codes for all possible return values of the interface functions.
Definition: ie_common.h:175
This is a header file for the ICNNNetwork class.
a header file for IInferRequest interface
a header file for IMemoryState interface
std::map< std::string, CDataPtr > ConstOutputsDataMap
A collection that contains string as key, and const Data smart pointer as value.
Definition: ie_iexecutable_network.hpp:27
virtual StatusCode Export(const std::string &modelFileName, ResponseDesc *resp) noexcept=0
Exports the current executable network so it can be used later in the Import() main API...
virtual StatusCode GetExecGraphInfo(ICNNNetwork::Ptr &graphPtr, ResponseDesc *resp) noexcept=0
Get executable graph information from a device.
Represents detailed information for an error.
Definition: ie_common.h:198
virtual StatusCode GetMappedTopology(std::map< std::string, std::vector< PrimitiveInfo::Ptr >> &deployedTopology, ResponseDesc *resp) noexcept=0
Get the mapping of IR layer names to implemented kernels.
std::map< std::string, InputInfo::CPtr > ConstInputsDataMap
A collection that contains string as key, and const InputInfo smart pointer as value.
Definition: ie_input_info.hpp:198
virtual StatusCode GetOutputsInfo(ConstOutputsDataMap &out, ResponseDesc *resp) const noexcept=0
Gets the Executable network output Data node information. The received info is stored in the given Co...
virtual StatusCode QueryState(IMemoryState::Ptr &pState, size_t idx, ResponseDesc *resp) noexcept=0
Gets state control interface for given executable network, State control essential for recurrent netw...
virtual StatusCode GetInputsInfo(ConstInputsDataMap &inputs, ResponseDesc *resp) const noexcept=0
Gets the Executable network input Data node information. The received info is stored in the given Con...
virtual StatusCode CreateInferRequest(IInferRequest::Ptr &req, ResponseDesc *resp) noexcept=0
Creates an inference request object used to infer the network. The created request has allocated inpu...
This is an interface of an executable network.
Definition: ie_iexecutable_network.hpp:32
A header file for the PrimitiveInfo struct.
a header file for InputInfo class
std::shared_ptr< IExecutableNetwork > Ptr
A smart pointer to the current IExecutableNetwork object.
Definition: ie_iexecutable_network.hpp:37
This is a header file with common inference engine definitions.