dropout_layer.hpp
#ifndef CAFFE_DROPOUT_LAYER_HPP_
#define CAFFE_DROPOUT_LAYER_HPP_
#include <vector>
#include "caffe/blob.hpp"
#include "caffe/layer.hpp"
#include "caffe/proto/caffe.pb.h"
#include "caffe/layers/neuron_layer.hpp"
namespace caffe {
template <typename Dtype>
class DropoutLayer : public NeuronLayer<Dtype> {
public:
explicit DropoutLayer(const LayerParameter& param)
: NeuronLayer<Dtype>(param) {}
virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top);
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top);
virtual inline const char* type() const { return "Dropout"; }
protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top);
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
Blob<unsigned int> rand_vec_;
Dtype threshold_;
Dtype scale_;
unsigned int uint_thres_;
};
} // namespace caffe
#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