Publishing R3
[platform/upstream/dldt.git] / inference-engine / src / inference_engine / cpp_interfaces / interface / ie_iplugin_internal.hpp
1 // Copyright (C) 2018 Intel Corporation
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5
6 /**
7  * \brief inference engine plugin API wrapper, to be used by particular implementors
8  * \file ie_plugin_base.hpp
9  */
10
11 #pragma once
12
13 #include <memory>
14 #include <map>
15 #include <string>
16 #include <ie_icnn_network.hpp>
17 #include <ie_iexecutable_network.hpp>
18 #include <ie_iextension.h>
19
20 namespace InferenceEngine {
21
22 /**
23  * @brief minimum API to be implemented by plugin, which is used in PluginBase forwarding mechanism
24  */
25 class IInferencePluginInternal {
26 public:
27     virtual ~IInferencePluginInternal() = default;
28
29     /**
30      * @deprecated use LoadNetwork with 4 parameters (executable network, cnn network, config, response)
31      * @brief Loads a pre-built network with weights to the engine so it will be ready for inference
32      * @param network - a network object acquired from CNNNetReader
33      */
34     virtual void LoadNetwork(ICNNNetwork &network) = 0;
35
36     /**
37      * @brief Creates an executable network from an pares network object, users can create as many networks as they need and use
38      *        them simultaneously (up to the limitation of the HW resources)
39      * @param executableNetwork - a reference to a shared ptr of the returned network interface
40      * @param network - a network object acquired from CNNNetReader
41      * @param config string-string map of config parameters relevant only for this load operation
42      */
43     virtual void LoadNetwork(IExecutableNetwork::Ptr &executableNetwork,
44                              ICNNNetwork &network,
45                              const std::map<std::string, std::string> &config) = 0;
46
47     /**
48      * @deprecated use Infer() working with multiple inputs and outputs
49      * @brief Infers an image(s)
50      * Input and output dimension depend on topology.
51      *     As an example for classification topologies use a 4D Blob as input (batch, channels, width,
52      *             height) and get a 1D blob as output (scoring probability vector). To Infer a batch,
53      *             use a 4D Blob as input and get a 2D blob as output in both cases the method will
54      *             allocate the resulted blob
55      * @param input - any TBlob<> object that contains the data to infer. the type of TBlob must correspond to the network input precision and size.
56      * @param result - a related TBlob<> object that will contain the result of the inference action, typically this should be a float blob.
57                The blob does not need to be allocated or initialized, the engine will allocate the relevant data
58      */
59     virtual void Infer(const Blob &input, Blob &result) = 0;
60
61     /**
62      * @deprecated load IExecutableNetwork to create IInferRequest.
63      * @brief Infer data: to Infer tensors. Input and ouput dimension depend on topology.
64      *     As an example for classification topologies use a 4D Blob as input (batch, chanels, width,
65      *             height) and get a 1D blob as output (scoring probability vector). To Infer a batch,
66      *             use a 4D Blob as input and get a 2D blob as output in both cases the method will
67      *             allocate the resulted blob
68      * @param input - map of input blobs accessed by input names
69      * @param result - map of output blobs accessed by output names
70      */
71     virtual void Infer(const BlobMap &input, BlobMap &result) = 0;
72
73     /**
74      * @deprecated use IInferRequest to get performance measures
75      * @brief Queries performance measures per layer to get feedback of what is the most time consuming layer.
76      *  Note: not all plugins may provide meaningful data
77      *  @param perfMap - a map of layer names to profiling information for that layer.
78      */
79     virtual void GetPerformanceCounts(std::map<std::string, InferenceEngineProfileInfo> &perfMap) = 0;
80
81     /**
82      * @brief Registers extension within plugin
83      * @param extension - pointer to already loaded extension
84      */
85     virtual void AddExtension(InferenceEngine::IExtensionPtr extension) = 0;
86
87     /**
88      * @brief Sets configuration for plugin, acceptable keys can be found in ie_plugin_config.hpp
89      * @param config string-string map of config parameters
90      */
91     virtual void SetConfig(const std::map<std::string, std::string> &config) = 0;
92
93     /**
94      * @brief Creates an executable network from an previously exported network
95      * @param ret - a reference to a shared ptr of the returned network interface
96      * @param modelFileName - path to the location of the exported file
97      */
98     virtual IExecutableNetwork::Ptr ImportNetwork(const std::string &modelFileName, const std::map<std::string, std::string> &config) = 0;
99
100     /**
101      * @brief Sets logging callback
102      * Logging is used to track what is going on inside
103      * @param listener - logging sink
104      */
105     virtual void SetLogCallback(IErrorListener &listener) = 0;
106
107     /**
108      * @depricated Use the version with config parameter
109      */
110     virtual void QueryNetwork(const ICNNNetwork& network, QueryNetworkResult& res) const = 0;
111
112     virtual void QueryNetwork(const ICNNNetwork &network, const std::map<std::string, std::string>& config, QueryNetworkResult &res) const = 0;
113 };
114
115 }  // namespace InferenceEngine