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 
29 namespace mlpack {
30 namespace ann {
31 
107 template <
108  typename InputDataType = arma::mat,
109  typename OutputDataType = arma::mat
110 >
111 class ELU
112 {
113  public:
119  ELU();
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 uint32_t /* 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
double const & Alpha() const
Get the non zero gradient.
Definition: elu.hpp:164
Linear algebra utility functions, generally performed on matrices or vectors.
OutputDataType & Delta()
Modify the delta.
Definition: elu.hpp:161
bool & Deterministic()
Modify the value of deterministic parameter.
Definition: elu.hpp:171
The core includes that mlpack expects; standard C++ includes and Armadillo.
bool Deterministic() const
Get the value of deterministic parameter.
Definition: elu.hpp:169
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: elu.hpp:154
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
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...
ELU()
Create the ELU object.
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
double & Alpha()
Modify the non zero gradient.
Definition: elu.hpp:166
The ELU activation function, defined by.
Definition: elu.hpp:111
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: elu.hpp:156
double const & Lambda() const
Get the lambda parameter.
Definition: elu.hpp:174
OutputDataType const & Delta() const
Get the delta.
Definition: elu.hpp:159