MagmaDNN  1.0
c++NeuralNetworkFramework
poolinglayer.h
Go to the documentation of this file.
1 
9 #include <vector>
10 #include "layer/layer.h"
11 #include "tensor/tensor.h"
12 #include "compute/operation.h"
13 #include "compute/tensor_operations.h"
15 
16 namespace magmadnn {
17 namespace layer {
18 
19 template <typename T>
20 class PoolingLayer : public Layer<T> {
21 public:
22  PoolingLayer(op::Operation<T> *input, const std::vector<unsigned int>& filter_shape={2, 2}, const std::vector<unsigned int>& padding={0,0},
23  const std::vector<unsigned int>& strides={1,1}, pooling_mode mode = MAX_POOL, bool propagate_nan=false);
24 
25  virtual ~PoolingLayer();
26 
27  virtual std::vector<op::Operation<T> *> get_weights();
28 
29 protected:
30  void init();
31 
32  pooling_mode mode;
33  bool propagate_nan;
34  int filter_h, filter_w, pad_h, pad_w, stride_h, stride_w;
35 
36 };
37 
48 template <typename T>
49 PoolingLayer<T>* pooling(op::Operation<T> *input, const std::vector<unsigned int>& filter_shape={2, 2}, const std::vector<unsigned int>& padding={0,0},
50  const std::vector<unsigned int>& strides={1,1}, pooling_mode mode = MAX_POOL, bool propagate_nan=false);
51 
52 /* Indicate pooling type when creating */
53 template <typename T>
54 PoolingLayer<T>* pooling(op::Operation<T> *input, const std::vector<unsigned int>& filter_shape={2, 2}, layer::padding_t padding=layer::SAME,
55  const std::vector<unsigned int>& strides={1,1}, pooling_mode mode = MAX_POOL, bool propagate_nan=false);
56 
57 } // layer
58 } // magmadnn
Definition: addop.cpp:11
Definition: poolinglayer.h:20
Definition: layer.h:18
Definition: operation.h:18