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