mlpack
master
|
The LeakyReLU activation function, defined by. More...
Public Member Functions | |
LeakyReLU (const double alpha=0.03) | |
Create the LeakyReLU object using the specified parameters. More... | |
double const & | Alpha () const |
Get the non zero gradient. More... | |
double & | Alpha () |
Modify the non zero gradient. More... | |
template<typename DataType > | |
void | Backward (const DataType &&input, DataType &&gy, DataType &&g) |
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards through f. More... | |
OutputDataType const & | Delta () const |
Get the delta. More... | |
OutputDataType & | Delta () |
Modify the delta. More... | |
template<typename InputType , typename OutputType > | |
void | Forward (const InputType &&input, OutputType &&output) |
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More... | |
InputDataType const & | InputParameter () const |
Get the input parameter. More... | |
InputDataType & | InputParameter () |
Modify the input parameter. More... | |
OutputDataType const & | OutputParameter () const |
Get the output parameter. More... | |
OutputDataType & | OutputParameter () |
Modify the output parameter. More... | |
template<typename Archive > | |
void | Serialize (Archive &ar, const unsigned int) |
Serialize the layer. More... | |
Private Member Functions | |
double | Deriv (const double x) |
Computes the first derivative of the LeakyReLU function. More... | |
template<typename InputType , typename OutputType > | |
void | Deriv (const InputType &x, OutputType &y) |
Computes the first derivative of the LeakyReLU function. More... | |
double | Fn (const double x) |
Computes the LeakReLU function. More... | |
template<typename eT > | |
void | Fn (const arma::Mat< eT > &x, arma::Mat< eT > &y) |
Computes the Leaky ReLU function using a dense matrix as input. More... | |
Private Attributes | |
double | alpha |
Leakyness Parameter in the range 0 <alpha< 1. More... | |
OutputDataType | delta |
Locally-stored delta object. More... | |
InputDataType | inputParameter |
Locally-stored input parameter object. More... | |
OutputDataType | outputParameter |
Locally-stored output parameter object. More... | |
The LeakyReLU activation function, defined by.
InputDataType | Type of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
OutputDataType | Type of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
Definition at line 44 of file leaky_relu.hpp.
mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::LeakyReLU | ( | const double | alpha = 0.03 | ) |
Create the LeakyReLU object using the specified parameters.
The non zero gradient can be adjusted by specifying tha parameter alpha in the range 0 to 1. Default (alpha = 0.03)
alpha | Non zero gradient |
|
inline |
Get the non zero gradient.
Definition at line 94 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::alpha.
|
inline |
Modify the non zero gradient.
Definition at line 96 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::alpha, and mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::Serialize().
void mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::Backward | ( | const DataType && | input, |
DataType && | gy, | ||
DataType && | g | ||
) |
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards through f.
Using the results from the feed forward pass.
input | The propagated input activation. |
gy | The backpropagated error. |
g | The calculated gradient. |
|
inline |
Get the delta.
Definition at line 89 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::delta.
|
inline |
Modify the delta.
Definition at line 91 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::delta.
|
inlineprivate |
Computes the first derivative of the LeakyReLU function.
x | Input data. |
Definition at line 134 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::alpha.
Referenced by mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::Deriv().
|
inlineprivate |
Computes the first derivative of the LeakyReLU function.
y | Input activations. |
x | The resulting derivatives. |
Definition at line 147 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::Deriv().
|
inlineprivate |
Computes the LeakReLU function.
x | Input data. |
Definition at line 111 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::alpha.
|
inlineprivate |
Computes the Leaky ReLU function using a dense matrix as input.
x | Input data. |
y | The resulting output activation. |
Definition at line 123 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::alpha.
void mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::Forward | ( | const InputType && | input, |
OutputType && | output | ||
) |
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.
input | Input data used for evaluating the specified function. |
output | Resulting output activation. |
|
inline |
Get the input parameter.
Definition at line 79 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::inputParameter.
|
inline |
Modify the input parameter.
Definition at line 81 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::inputParameter.
|
inline |
Get the output parameter.
Definition at line 84 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::outputParameter.
|
inline |
Modify the output parameter.
Definition at line 86 of file leaky_relu.hpp.
References mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::outputParameter.
void mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::Serialize | ( | Archive & | ar, |
const unsigned | int | ||
) |
Serialize the layer.
Referenced by mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::Alpha().
|
private |
Leakyness Parameter in the range 0 <alpha< 1.
Definition at line 167 of file leaky_relu.hpp.
Referenced by mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::Alpha(), mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::Deriv(), and mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::Fn().
|
private |
Locally-stored delta object.
Definition at line 158 of file leaky_relu.hpp.
Referenced by mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::Delta().
|
private |
Locally-stored input parameter object.
Definition at line 161 of file leaky_relu.hpp.
Referenced by mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::InputParameter().
|
private |
Locally-stored output parameter object.
Definition at line 164 of file leaky_relu.hpp.
Referenced by mlpack::ann::LeakyReLU< InputDataType, OutputDataType >::OutputParameter().