Caffe
cudnn_lcn_layer.hpp
1 #ifndef CAFFE_CUDNN_LCN_LAYER_HPP_
2 #define CAFFE_CUDNN_LCN_LAYER_HPP_
3 
4 #include <vector>
5 
6 #include "caffe/blob.hpp"
7 #include "caffe/layer.hpp"
8 #include "caffe/proto/caffe.pb.h"
9 
10 #include "caffe/layers/lrn_layer.hpp"
11 #include "caffe/layers/power_layer.hpp"
12 
13 namespace caffe {
14 
15 #ifdef USE_CUDNN
16 template <typename Dtype>
17 class CuDNNLCNLayer : public LRNLayer<Dtype> {
18  public:
19  explicit CuDNNLCNLayer(const LayerParameter& param)
20  : LRNLayer<Dtype>(param), handles_setup_(false), tempDataSize(0),
21  tempData1(NULL), tempData2(NULL) {}
22  virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
23  const vector<Blob<Dtype>*>& top);
24  virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
25  const vector<Blob<Dtype>*>& top);
26  virtual ~CuDNNLCNLayer();
27 
28  protected:
29  virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
30  const vector<Blob<Dtype>*>& top);
31  virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
32  const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
33 
34  bool handles_setup_;
35  cudnnHandle_t handle_;
36  cudnnLRNDescriptor_t norm_desc_;
37  cudnnTensorDescriptor_t bottom_desc_, top_desc_;
38 
39  int size_, pre_pad_;
40  Dtype alpha_, beta_, k_;
41 
42  size_t tempDataSize;
43  void *tempData1, *tempData2;
44 };
45 #endif
46 
47 } // namespace caffe
48 
49 #endif // CAFFE_CUDNN_LCN_LAYER_HPP_
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14