Caffe
cudnn_tanh_layer.hpp
1 #ifndef CAFFE_CUDNN_TANH_LAYER_HPP_
2 #define CAFFE_CUDNN_TANH_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/neuron_layer.hpp"
11 #include "caffe/layers/tanh_layer.hpp"
12 
13 namespace caffe {
14 
15 #ifdef USE_CUDNN
16 
19 template <typename Dtype>
20 class CuDNNTanHLayer : public TanHLayer<Dtype> {
21  public:
22  explicit CuDNNTanHLayer(const LayerParameter& param)
23  : TanHLayer<Dtype>(param), handles_setup_(false) {}
24  virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
25  const vector<Blob<Dtype>*>& top);
26  virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
27  const vector<Blob<Dtype>*>& top);
28  virtual ~CuDNNTanHLayer();
29 
30  protected:
31  virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
32  const vector<Blob<Dtype>*>& top);
33  virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
34  const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
35 
36  bool handles_setup_;
37  cudnnHandle_t handle_;
38  cudnnTensorDescriptor_t bottom_desc_;
39  cudnnTensorDescriptor_t top_desc_;
40  cudnnActivationDescriptor_t activ_desc_;
41 };
42 #endif
43 
44 } // namespace caffe
45 
46 #endif // CAFFE_CUDNN_TANH_LAYER_HPP_
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14