Caffe
All Classes Namespaces Functions Variables Typedefs
dropout_layer.hpp
1 #ifndef CAFFE_DROPOUT_LAYER_HPP_
2 #define CAFFE_DROPOUT_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 
12 namespace caffe {
13 
25 template <typename Dtype>
26 class DropoutLayer : public NeuronLayer<Dtype> {
27  public:
34  explicit DropoutLayer(const LayerParameter& param)
35  : NeuronLayer<Dtype>(param) {}
36  virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
37  const vector<Blob<Dtype>*>& top);
38  virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
39  const vector<Blob<Dtype>*>& top);
40 
41  virtual inline const char* type() const { return "Dropout"; }
42 
43  protected:
60  virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
61  const vector<Blob<Dtype>*>& top);
62  virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
63  const vector<Blob<Dtype>*>& top);
64  virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
65  const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
66  virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
67  const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
68 
72  Dtype threshold_;
74  Dtype scale_;
75  unsigned int uint_thres_;
76 };
77 
78 } // namespace caffe
79 
80 #endif // CAFFE_DROPOUT_LAYER_HPP_
caffe::DropoutLayer::Forward_gpu
virtual void Forward_gpu(const vector< Blob< Dtype > * > &bottom, const vector< Blob< Dtype > * > &top)
Using the GPU device, compute the layer output. Fall back to Forward_cpu() if unavailable.
caffe::NeuronLayer
An interface for layers that take one blob as input ( ) and produce one equally-sized blob as output ...
Definition: neuron_layer.hpp:19
caffe::DropoutLayer::Backward_gpu
virtual void Backward_gpu(const vector< Blob< Dtype > * > &top, const vector< bool > &propagate_down, const vector< Blob< Dtype > * > &bottom)
Using the GPU device, compute the gradients for any parameters and for the bottom blobs if propagate_...
caffe::DropoutLayer::scale_
Dtype scale_
the scale for undropped inputs at train time
Definition: dropout_layer.hpp:74
caffe::DropoutLayer::Forward_cpu
virtual void Forward_cpu(const vector< Blob< Dtype > * > &bottom, const vector< Blob< Dtype > * > &top)
Definition: dropout_layer.cpp:31
caffe::Blob
A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers,...
Definition: blob.hpp:24
caffe::DropoutLayer::Backward_cpu
virtual void Backward_cpu(const vector< Blob< Dtype > * > &top, const vector< bool > &propagate_down, const vector< Blob< Dtype > * > &bottom)
Using the CPU device, compute the gradients for any parameters and for the bottom blobs if propagate_...
Definition: dropout_layer.cpp:49
caffe::DropoutLayer::type
virtual const char * type() const
Returns the layer type.
Definition: dropout_layer.hpp:41
caffe::DropoutLayer::threshold_
Dtype threshold_
the probability of dropping any input
Definition: dropout_layer.hpp:72
caffe::DropoutLayer::rand_vec_
Blob< unsigned int > rand_vec_
when divided by UINT_MAX, the randomly generated values
Definition: dropout_layer.hpp:70
caffe
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
caffe::DropoutLayer::Reshape
virtual void Reshape(const vector< Blob< Dtype > * > &bottom, const vector< Blob< Dtype > * > &top)
Adjust the shapes of top blobs and internal buffers to accommodate the shapes of the bottom blobs.
Definition: dropout_layer.cpp:22
caffe::DropoutLayer
During training only, sets a random portion of to 0, adjusting the rest of the vector magnitude acco...
Definition: dropout_layer.hpp:26
caffe::DropoutLayer::LayerSetUp
virtual void LayerSetUp(const vector< Blob< Dtype > * > &bottom, const vector< Blob< Dtype > * > &top)
Does layer-specific setup: your layer should implement this function as well as Reshape.
Definition: dropout_layer.cpp:11
caffe::DropoutLayer::DropoutLayer
DropoutLayer(const LayerParameter &param)
Definition: dropout_layer.hpp:34