15 #ifndef MLPACK_METHODS_ANN_LAYER_PReLU_HPP 16 #define MLPACK_METHODS_ANN_LAYER_PReLU_HPP 42 typename InputDataType = arma::mat,
43 typename OutputDataType = arma::mat
56 PReLU(
const double userAlpha = 0.03);
70 template<
typename InputType,
typename OutputType>
71 void Forward(
const InputType& input, OutputType& output);
82 template<
typename DataType>
83 void Backward(
const DataType& input,
const DataType& gy, DataType& g);
93 void Gradient(
const arma::Mat<eT>& input,
94 const arma::Mat<eT>& error,
95 arma::Mat<eT>& gradient);
98 OutputDataType
const&
Parameters()
const {
return alpha; }
108 OutputDataType
const&
Delta()
const {
return delta; }
110 OutputDataType&
Delta() {
return delta; }
113 OutputDataType
const&
Gradient()
const {
return gradient; }
118 double const&
Alpha()
const {
return alpha(0); }
120 double&
Alpha() {
return alpha(0); }
128 template<
typename Archive>
129 void serialize(Archive& ar,
const uint32_t );
133 OutputDataType delta;
136 OutputDataType outputParameter;
139 OutputDataType alpha;
142 OutputDataType gradient;
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t WeightSize() const
Get size of weights.
Definition: parametric_relu.hpp:123
void Backward(const DataType &input, const DataType &gy, DataType &g)
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backw...
Definition: parametric_relu_impl.hpp:51
OutputDataType const & Gradient() const
Get the gradient.
Definition: parametric_relu.hpp:113
OutputDataType const & Parameters() const
Get the parameters.
Definition: parametric_relu.hpp:98
The PReLU activation function, defined by (where alpha is trainable)
Definition: parametric_relu.hpp:45
PReLU(const double userAlpha=0.03)
Create the PReLU object using the specified parameters.
Definition: parametric_relu_impl.hpp:25
OutputDataType const & Delta() const
Get the delta.
Definition: parametric_relu.hpp:108
OutputDataType & Parameters()
Modify the parameters.
Definition: parametric_relu.hpp:100
OutputDataType & Gradient()
Modify the gradient.
Definition: parametric_relu.hpp:115
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
Definition: parametric_relu_impl.hpp:41
double & Alpha()
Modify the non zero gradient.
Definition: parametric_relu.hpp:120
OutputDataType & Delta()
Modify the delta.
Definition: parametric_relu.hpp:110
void Reset()
Definition: parametric_relu_impl.hpp:33
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: parametric_relu.hpp:103
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: parametric_relu.hpp:105
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
Definition: parametric_relu_impl.hpp:82
double const & Alpha() const
Get the non zero gradient.
Definition: parametric_relu.hpp:118