prelu_layer.hpp
#ifndef CAFFE_PRELU_LAYER_HPP_
#define CAFFE_PRELU_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 PReLULayer : public NeuronLayer<Dtype> {
public:
explicit PReLULayer(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 "PReLU"; }
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);
bool channel_shared_;
Blob<Dtype> multiplier_; // dot multiplier for backward computation of params
Blob<Dtype> backward_buff_; // temporary buffer for backward computation
Blob<Dtype> bottom_memory_; // memory for in-place computation
};
} // namespace caffe
#endif // CAFFE_PRELU_LAYER_HPP_
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::PReLULayer::Forward_cpu
virtual void Forward_cpu(const vector< Blob< Dtype > * > &bottom, const vector< Blob< Dtype > * > &top)
Definition: prelu_layer.cpp:67
caffe::PReLULayer::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::PReLULayer::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::Blob
A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers,...
Definition: blob.hpp:24
caffe::PReLULayer::type
virtual const char * type() const
Returns the layer type.
Definition: prelu_layer.hpp:42
caffe::PReLULayer::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: prelu_layer.cpp:12
caffe::PReLULayer
Parameterized Rectified Linear Unit non-linearity . The differences from ReLULayer are 1) negative sl...
Definition: prelu_layer.hpp:23
caffe::PReLULayer::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: prelu_layer.cpp:55
caffe::PReLULayer::Backward_cpu
virtual void Backward_cpu(const vector< Blob< Dtype > * > &top, const vector< bool > &propagate_down, const vector< Blob< Dtype > * > &bottom)
Computes the error gradient w.r.t. the PReLU inputs.
Definition: prelu_layer.cpp:92
caffe::PReLULayer::PReLULayer
PReLULayer(const LayerParameter &param)
Definition: prelu_layer.hpp:33
caffe
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14