Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / mkldnn_plugin / mkldnn_infer_request.h
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include "mkldnn_graph.h"
8 #include <memory>
9 #include <string>
10 #include <map>
11 #include <cpp_interfaces/impl/ie_infer_request_internal.hpp>
12
13 namespace MKLDNNPlugin {
14
15 class MKLDNNInferRequest : public InferenceEngine::InferRequestInternal {
16 public:
17     typedef std::shared_ptr<MKLDNNInferRequest> Ptr;
18     explicit MKLDNNInferRequest(InferenceEngine::InputsDataMap networkInputs,
19                           InferenceEngine::OutputsDataMap networkOutputs);
20
21     void InferImpl() override;
22
23     void GetPerformanceCounts(std::map<std::string, InferenceEngine::InferenceEngineProfileInfo> &perfMap) const override;
24
25     /**
26      * @brief Given optional implementation of setting blob to avoid need for it to be implemented by plugin
27      * @param name - a name of input or output blob.
28      * @param data - a reference to input or output blob. The type of Blob must correspond to the network input precision and size.
29      */
30     void SetBlob(const char *name, const InferenceEngine::Blob::Ptr &data) override;
31
32     /**
33      * @brief Given optional implementation of getting blob to avoid need for it to be implemented by plugin
34      * @param name - a name of input or output blob.
35      * @param data - a reference to input or output blob. The type of Blob must correspond to the network input precision and size.
36      */
37     void GetBlob(const char *name, InferenceEngine::Blob::Ptr &data) override;
38
39     void SetGraph(const MKLDNNGraph::Ptr& graph);
40
41     void SetBatch(int batch = -1) override;
42
43 private:
44     template <typename T> void pushInput(const std::string& inputName, InferenceEngine::Blob::Ptr& inputBlob);
45
46     void changeDefaultPtr();
47     MKLDNNGraph::Ptr graph;
48     std::map<std::string, void*> externalPtr;
49 };
50 }  // namespace MKLDNNPlugin