Caffe
cudnn_lrn_layer.hpp
1 #ifndef CAFFE_CUDNN_LRN_LAYER_HPP_
2 #define CAFFE_CUDNN_LRN_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 
12 namespace caffe {
13 
14 #ifdef USE_CUDNN
15 template <typename Dtype>
16 class CuDNNLRNLayer : public LRNLayer<Dtype> {
17  public:
18  explicit CuDNNLRNLayer(const LayerParameter& param)
19  : LRNLayer<Dtype>(param), handles_setup_(false) {}
20  virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
21  const vector<Blob<Dtype>*>& top);
22  virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
23  const vector<Blob<Dtype>*>& top);
24  virtual ~CuDNNLRNLayer();
25 
26  protected:
27  virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
28  const vector<Blob<Dtype>*>& top);
29  virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
30  const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
31 
32  bool handles_setup_;
33  cudnnHandle_t handle_;
34  cudnnLRNDescriptor_t norm_desc_;
35  cudnnTensorDescriptor_t bottom_desc_, top_desc_;
36 
37  int size_;
38  Dtype alpha_, beta_, k_;
39 };
40 #endif
41 
42 } // namespace caffe
43 
44 #endif // CAFFE_CUDNN_LRN_LAYER_HPP_
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14