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