mlpack 3.4.2
elu.hpp
Go to the documentation of this file.
1
24#ifndef MLPACK_METHODS_ANN_LAYER_ELU_HPP
25#define MLPACK_METHODS_ANN_LAYER_ELU_HPP
26
27#include <mlpack/prereqs.hpp>
28
29namespace mlpack {
30namespace ann {
31
107template <
108 typename InputDataType = arma::mat,
109 typename OutputDataType = arma::mat
110>
111class ELU
112{
113 public:
120
129 ELU(const double alpha);
130
138 template<typename InputType, typename OutputType>
139 void Forward(const InputType& input, OutputType& output);
140
150 template<typename DataType>
151 void Backward(const DataType& input, const DataType& gy, DataType& g);
152
154 OutputDataType const& OutputParameter() const { return outputParameter; }
156 OutputDataType& OutputParameter() { return outputParameter; }
157
159 OutputDataType const& Delta() const { return delta; }
161 OutputDataType& Delta() { return delta; }
162
164 double const& Alpha() const { return alpha; }
166 double& Alpha() { return alpha; }
167
169 bool Deterministic() const { return deterministic; }
171 bool& Deterministic() { return deterministic; }
172
174 double const& Lambda() const { return lambda; }
175
179 template<typename Archive>
180 void serialize(Archive& ar, const unsigned int /* version */);
181
182 private:
184 OutputDataType delta;
185
187 OutputDataType outputParameter;
188
190 arma::mat derivative;
191
194 double alpha;
195
200 double lambda;
201
203 bool deterministic;
204}; // class ELU
205
206// Template alias for SELU using ELU class.
208
209} // namespace ann
210} // namespace mlpack
211
212// Include implementation.
213#include "elu_impl.hpp"
214
215#endif
The ELU activation function, defined by.
Definition: elu.hpp:112
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
OutputDataType const & Delta() const
Get the delta.
Definition: elu.hpp:159
ELU(const double alpha)
Create the ELU object using the specified parameter.
double & Alpha()
Modify the non zero gradient.
Definition: elu.hpp:166
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: elu.hpp:154
double const & Lambda() const
Get the lambda parameter.
Definition: elu.hpp:174
bool & Deterministic()
Modify the value of deterministic parameter.
Definition: elu.hpp:171
bool Deterministic() const
Get the value of deterministic parameter.
Definition: elu.hpp:169
ELU()
Create the ELU object.
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: elu.hpp:156
double const & Alpha() const
Get the non zero gradient.
Definition: elu.hpp:164
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...
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType & Delta()
Modify the delta.
Definition: elu.hpp:161
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.