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