1 // Copyright (C) 2018 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
7 * \brief inference engine plugin API wrapper, to be used by particular implementors
8 * \file ie_plugin_base.hpp
16 #include <ie_icnn_network.hpp>
17 #include <ie_iexecutable_network.hpp>
18 #include <ie_iextension.h>
20 namespace InferenceEngine {
23 * @brief minimum API to be implemented by plugin, which is used in PluginBase forwarding mechanism
25 class IInferencePluginInternal {
27 virtual ~IInferencePluginInternal() = default;
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
34 virtual void LoadNetwork(ICNNNetwork &network) = 0;
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
43 virtual void LoadNetwork(IExecutableNetwork::Ptr &executableNetwork,
45 const std::map<std::string, std::string> &config) = 0;
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
59 virtual void Infer(const Blob &input, Blob &result) = 0;
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
71 virtual void Infer(const BlobMap &input, BlobMap &result) = 0;
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.
79 virtual void GetPerformanceCounts(std::map<std::string, InferenceEngineProfileInfo> &perfMap) = 0;
82 * @brief Registers extension within plugin
83 * @param extension - pointer to already loaded extension
85 virtual void AddExtension(InferenceEngine::IExtensionPtr extension) = 0;
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
91 virtual void SetConfig(const std::map<std::string, std::string> &config) = 0;
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
98 virtual IExecutableNetwork::Ptr ImportNetwork(const std::string &modelFileName, const std::map<std::string, std::string> &config) = 0;
101 * @brief Sets logging callback
102 * Logging is used to track what is going on inside
103 * @param listener - logging sink
105 virtual void SetLogCallback(IErrorListener &listener) = 0;
108 * @depricated Use the version with config parameter
110 virtual void QueryNetwork(const ICNNNetwork& network, QueryNetworkResult& res) const = 0;
112 virtual void QueryNetwork(const ICNNNetwork &network, const std::map<std::string, std::string>& config, QueryNetworkResult &res) const = 0;
115 } // namespace InferenceEngine