-
Notifications
You must be signed in to change notification settings - Fork 93
/
vision_layers.hpp
61 lines (47 loc) · 1.81 KB
/
vision_layers.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef CAFFEINE_VISION_LAYERS_HPP_
#define CAFFEINE_VISION_LAYERS_HPP_
#include "caffeine/layer.hpp"
namespace caffeine {
template <typename Dtype>
class NeuronLayer : public Layer<Dtype> {
public:
explicit NeuronLayer(const LayerParameter& param)
: Layer<Dtype>(param) {};
virtual void SetUp(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
};
template <typename Dtype>
class ReLULayer : public NeuronLayer<Dtype> {
public:
explicit ReLULayer(const LayerParameter& param)
: NeuronLayer<Dtype>(param) {};
protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
virtual Dtype Backward_cpu(const vector<Blob<Dtype>*>& top,
const bool propagate_down, vector<Blob<Dtype>*>* bottom);
virtual Dtype Backward_gpu(const vector<Blob<Dtype>*>& top,
const bool propagate_down, vector<Blob<Dtype>*>* bottom);
};
template <typename Dtype>
class DropoutLayer : public NeuronLayer<Dtype> {
public:
explicit DropoutLayer(const LayerParameter& param)
: NeuronLayer<Dtype>(param) {};
virtual void SetUp(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top);
virtual Dtype Backward_cpu(const vector<Blob<Dtype>*>& top,
const bool propagate_down, vector<Blob<Dtype>*>* bottom);
virtual Dtype Backward_gpu(const vector<Blob<Dtype>*>& top,
const bool propagate_down, vector<Blob<Dtype>*>* bottom);
shared_ptr<SyncedMemory> rand_vec_;
};
} // namespace caffeine
#endif // CAFFEINE_VISION_LAYERS_HPP_