isrlu.hpp
Go to the documentation of this file.
1 
24 #ifndef MLPACK_METHODS_ANN_LAYER_ISRLU_HPP
25 #define MLPACK_METHODS_ANN_LAYER_ISRLU_HPP
26 
27 #include <mlpack/prereqs.hpp>
28 
29 namespace mlpack {
30 namespace ann {
31 
56 template <
57  typename InputDataType = arma::mat,
58  typename OutputDataType = arma::mat
59 >
60 class ISRLU
61 {
62  public:
69  ISRLU(const double alpha = 1.0);
70 
78  template<typename InputType, typename OutputType>
79  void Forward(const InputType& input, OutputType& output);
80 
90  template<typename DataType>
91  void Backward(const DataType& input, const DataType& gy, DataType& g);
92 
94  OutputDataType const& OutputParameter() const { return outputParameter; }
96  OutputDataType& OutputParameter() { return outputParameter; }
97 
99  OutputDataType const& Delta() const { return delta; }
101  OutputDataType& Delta() { return delta; }
102 
104  double const& Alpha() const { return alpha; }
106  double& Alpha() { return alpha; }
107 
109  size_t WeightSize() { return 0; }
110 
114  template<typename Archive>
115  void serialize(Archive& ar, const uint32_t /* version */);
116 
117  private:
119  OutputDataType delta;
120 
122  OutputDataType outputParameter;
123 
125  arma::mat derivative;
126 
128  double alpha;
129 }; // class ISRLU
130 
131 } // namespace ann
132 } // namespace mlpack
133 
134 // Include implementation.
135 #include "isrlu_impl.hpp"
136 
137 #endif
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
The ISRLU activation function, defined by.
Definition: isrlu.hpp:60
Linear algebra utility functions, generally performed on matrices or vectors.
ISRLU(const double alpha=1.0)
Create the ISRLU object using the specified parameter.
OutputDataType & Delta()
Modify the delta.
Definition: isrlu.hpp:101
The core includes that mlpack expects; standard C++ includes and Armadillo.
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...
double & Alpha()
Modify the non zero gradient.
Definition: isrlu.hpp:106
size_t WeightSize()
Get size of weights.
Definition: isrlu.hpp:109
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: isrlu.hpp:96
OutputDataType const & Delta() const
Get the delta.
Definition: isrlu.hpp:99
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 & OutputParameter() const
Get the output parameter.
Definition: isrlu.hpp:94
double const & Alpha() const
Get the non zero gradient.
Definition: isrlu.hpp:104