Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / mkldnn_plugin / nodes / mkldnn_depthwise_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 MKLDNNDepthwiseNode : public MKLDNNNode {
16 public:
17     MKLDNNDepthwiseNode(InferenceEngine::CNNLayerPtr layer, const mkldnn::engine& eng);
18     ~MKLDNNDepthwiseNode() override = default;
19
20     void createDescriptor(const std::vector<InferenceEngine::TensorDesc>& inputDesc,
21                           const std::vector<InferenceEngine::TensorDesc>& outputDesc) override;
22     void initOptimalPrimitiveDescriptor() override;
23     void getSupportedDescriptors() override;
24     void createPrimitive() override;
25     bool created() const override;
26
27     mkldnn::algorithm getAlgorithm() {
28         if (!initialized)
29             initValues();
30         return algorithm;
31     }
32
33     bool isWithBiases() {
34         if (!initialized)
35             initValues();
36         return withBiases;
37     }
38
39     bool isBroadcast() {
40         if (!initialized)
41             initValues();
42         return broadcast;
43     }
44
45 private:
46     void initValues();
47     bool initialized = false;
48
49     static Register<MKLDNNDepthwiseNode> reg;
50
51     mkldnn::algorithm algorithm;
52     size_t realWeightSize = 0;
53     size_t realBiasSize = 0;
54     bool withBiases;
55     bool broadcast;
56 };
57
58 }  // namespace MKLDNNPlugin