Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / mkldnn_plugin / nodes / mkldnn_reorder_node.h
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include <ie_common.h>
8 #include <mkldnn_node.h>
9 #include <string>
10 #include <memory>
11 #include <vector>
12
13 namespace MKLDNNPlugin {
14
15 class MKLDNNReorderNode : public MKLDNNNode {
16 public:
17     MKLDNNReorderNode(const InferenceEngine::CNNLayerPtr& layer, const mkldnn::engine& eng);
18     ~MKLDNNReorderNode() override = default;
19
20     void getSupportedDescriptors() override;
21     void initSupportedPrimitiveDescriptors() override;
22     void createPrimitive() override;
23     void execute(mkldnn::stream strm) override;
24     bool created() const override;
25     const std::vector<impl_desc_type>& getPrimitivesPriority() override;
26
27     void setDescs(const InferenceEngine::TensorDesc& input, const InferenceEngine::TensorDesc& output) {
28         this->input = input;
29         this->output = output;
30     }
31
32     void setDynamicBatchLim(int lim) override;
33
34     bool canBeInPlace() const override {
35         return false;
36     }
37
38     const InferenceEngine::TensorDesc& getInput() { return input; }
39     const InferenceEngine::TensorDesc& getOutput() { return output; }
40
41     /**
42      * @brief A pointer to a scales blob
43      */
44     InferenceEngine::Blob::Ptr _scales;
45
46 private:
47     static Register<MKLDNNReorderNode> reg;
48     InferenceEngine::TensorDesc input;
49     InferenceEngine::TensorDesc output;
50
51     MKLDNNMemoryPtr dst_blocked;
52     MKLDNNMemoryPtr src_blocked;
53
54     void createReorderPrimitive(mkldnn::memory::desc srcDesc, void* srcPtr, mkldnn::memory::desc dstDesc, void* dstPtr);
55 };
56
57 }  // namespace MKLDNNPlugin
58