ie_pooling_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 Pooling layer
22  */
23 IE_SUPPRESS_DEPRECATED_START
24 class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(PoolingLayer): public LayerDecorator {
25 public:
26  /**
27  * @brief The enum defines available pooling types
28  */
29  enum PoolingType { MAX = 1, AVG = 2 };
30 
31  /**
32  * @brief The enum defines available rounding types
33  */
34  enum RoundingType { CEIL = 1, FLOOR = 2 };
35 
36  /**
37  * @brief The constructor creates a builder with the name
38  * @param name Layer name
39  */
40  explicit PoolingLayer(const std::string& name = "");
41  /**
42  * @brief The constructor creates a builder from generic builder
43  * @param layer pointer to generic builder
44  */
45  explicit PoolingLayer(const Layer::Ptr& layer);
46  /**
47  * @brief The constructor creates a builder from generic builder
48  * @param layer constant pointer to generic builder
49  */
50  explicit PoolingLayer(const Layer::CPtr& layer);
51  /**
52  * @brief Operator creates generic layer builder
53  * @return Generic layer builder
54  */
55  operator Layer() const override;
56  /**
57  * @brief Sets the name for the layer
58  * @param name Layer name
59  * @return reference to layer builder
60  */
61  PoolingLayer& setName(const std::string& name);
62 
63  /**
64  * @brief Returns input port
65  * @return Input port
66  */
67  const Port& getInputPort() const;
68  /**
69  * @brief Sets input port
70  * @param port Input port
71  * @return reference to layer builder
72  */
73  PoolingLayer& setInputPort(const Port& port);
74  /**
75  * @brief Returns output port
76  * @return Output port
77  */
78  const Port& getOutputPort() const;
79  /**
80  * @brief Sets output port
81  * @param port Output port
82  * @return reference to layer builder
83  */
84  PoolingLayer& setOutputPort(const Port& port);
85  /**
86  * @brief Returns kernel size
87  * @return Kernel size
88  */
89  const std::vector<size_t> getKernel() const;
90  /**
91  * @brief Sets kernel size
92  * @param kernel Kernel size
93  * @return reference to layer builder
94  */
95  PoolingLayer& setKernel(const std::vector<size_t>& kernel);
96  /**
97  * @brief Returns vector of strides
98  * @return vector of strides
99  */
100  const std::vector<size_t> getStrides() const;
101  /**
102  * @brief Sets strides
103  * @param strides vector of strides
104  * @return reference to layer builder
105  */
106  PoolingLayer& setStrides(const std::vector<size_t>& strides);
107  /**
108  * @brief Returns begin paddings
109  * @return vector of paddings
110  */
111  const std::vector<size_t> getPaddingsBegin() const;
112  /**
113  * @brief Sets begin paddings
114  * @param paddings Vector of paddings
115  * @return reference to layer builder
116  */
117  PoolingLayer& setPaddingsBegin(const std::vector<size_t>& paddings);
118  /**
119  * @brief Return end paddings
120  * @return Vector of paddings
121  */
122  const std::vector<size_t> getPaddingsEnd() const;
123  /**
124  * @brief Sets end paddings
125  * @param paddings Vector of paddings
126  * @return reference to layer builder
127  */
128  PoolingLayer& setPaddingsEnd(const std::vector<size_t>& paddings);
129  /**
130  * @brief Returns pooling type
131  * @return Pooling type
132  */
133  PoolingType getPoolingType() const;
134  /**
135  * @brief Sets pooling type
136  * @param type Pooling type
137  * @return reference to layer builder
138  */
139  PoolingLayer& setPoolingType(PoolingType type);
140  /**
141  * @brief Returns rounding type
142  * @return Rounding type
143  */
144  RoundingType getRoundingType() const;
145  /**
146  * @brief Sets rounding types
147  * @param type Rounding type
148  * @return reference to layer builder
149  */
150  PoolingLayer& setRoundingType(RoundingType type);
151  /**
152  * @brief Returns a type of pooling strategy
153  * @return true if zero-values in the padding are not used
154  */
155  bool getExcludePad() const;
156  /**
157  * @brief Sets a type of pooling strategy
158  * @param exclude zero-values in the padding are not used if true
159  * @return reference to layer builder
160  */
161  PoolingLayer& setExcludePad(bool exclude);
162 
163 private:
164  PoolingType type = MAX;
165  RoundingType roundingType = CEIL;
166 };
167 IE_SUPPRESS_DEPRECATED_END
168 
169 } // namespace Builder
170 } // namespace InferenceEngine
This class implements a builder for IE Layer.
Definition: ie_layer_builder.hpp:43
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
The class represents a builder for Pooling layer.
Definition: ie_pooling_layer.hpp:24
std::shared_ptr< Layer > Ptr
A shared pointer to the Layer builder.
Definition: ie_layer_builder.hpp:48
PoolingType
The enum defines available pooling types.
Definition: ie_pooling_layer.hpp:29
A header file for the Inference Engine Network interface.
RoundingType
The enum defines available rounding types.
Definition: ie_pooling_layer.hpp:34
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