Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / include / builders / ie_eltwise_layer.hpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include <builders/ie_layer_decorator.hpp>
8 #include <ie_network.hpp>
9 #include <string>
10 #include <vector>
11
12 namespace InferenceEngine {
13 namespace Builder {
14
15 /**
16  * @brief The class represents a builder for Eltwise layer
17  */
18 class INFERENCE_ENGINE_API_CLASS(EltwiseLayer): public LayerDecorator {
19 public:
20     /**
21      * @brief The enum defines all Eltwise types
22      */
23     enum EltwiseType {
24         SUM = 1,
25         MAX,
26         MUL,
27         SUB,
28         DIV,
29         MIN,
30         SQUARED_DIFF
31     };
32
33     /**
34      * @brief The constructor creates a builder with the name
35      * @param name Layer name
36      */
37     explicit EltwiseLayer(const std::string& name = "");
38     /**
39      * @brief The constructor creates a builder from generic builder
40      * @param layer pointer to generic builder
41      */
42     explicit EltwiseLayer(const Layer::Ptr& layer);
43     /**
44      * @brief The constructor creates a builder from generic builder
45      * @param layer constant pointer to generic builder
46      */
47     explicit EltwiseLayer(const Layer::CPtr& layer);
48     /**
49      * @brief Sets the name for the layer
50      * @param name Layer name
51      * @return reference to layer builder
52      */
53     EltwiseLayer& setName(const std::string& name);
54
55     /**
56      * @brief Returns input ports
57      * @return Vector of input ports
58      */
59     const std::vector<Port>& getInputPorts() const;
60     /**
61      * @brief Sets input ports
62      * @param ports Vector of input ports
63      * @return reference to layer builder
64      */
65     EltwiseLayer& setInputPorts(const std::vector<Port>& ports);
66     /**
67      * @brief Returns output port
68      * @return Output port
69      */
70     const Port& getOutputPort() const;
71     /**
72      * @brief Sets output port
73      * @param port Output port
74      * @return reference to layer builder
75      */
76     EltwiseLayer& setOutputPort(const Port& port);
77     /**
78      * @brief Returns eltwise type
79      * @return Eltwise type
80      */
81     EltwiseType getEltwiseType() const;
82     /**
83      * @brief Sets eltwise type
84      * @param type Eltwise type
85      * @return reference to layer builder
86      */
87     EltwiseLayer& setEltwiseType(EltwiseType type);
88     /**
89      * @brief Returns eltwise scales
90      * @return Vector of scales
91      */
92     const std::vector<float> getScales() const;
93     /**
94      * @brief Sets eltwise scales
95      * @param scales Vector of scales
96      * @return reference to layer builder
97      */
98     EltwiseLayer& setScales(const std::vector<float>& scales);
99
100 private:
101     EltwiseType type;
102 };
103
104 }  // namespace Builder
105 }  // namespace InferenceEngine