13 #ifndef MLPACK_METHODS_ANN_LAYER_BASE_LAYER_HPP 14 #define MLPACK_METHODS_ANN_LAYER_BASE_LAYER_HPP 57 class ActivationFunction = LogisticFunction,
58 typename InputDataType = arma::mat,
59 typename OutputDataType = arma::mat
79 template<
typename InputType,
typename OutputType>
80 void Forward(
const InputType& input, OutputType& output)
82 ActivationFunction::Fn(input, output);
96 const arma::Mat<eT>& gy,
99 arma::Mat<eT> derivative;
100 ActivationFunction::Deriv(input, derivative);
110 OutputDataType
const&
Delta()
const {
return delta; }
112 OutputDataType&
Delta() {
return delta; }
117 template<
typename Archive>
125 OutputDataType delta;
128 OutputDataType outputParameter;
138 typename InputDataType = arma::mat,
139 typename OutputDataType = arma::mat
142 ActivationFunction, InputDataType, OutputDataType>;
149 typename InputDataType = arma::mat,
150 typename OutputDataType = arma::mat
153 ActivationFunction, InputDataType, OutputDataType>;
160 typename InputDataType = arma::mat,
161 typename OutputDataType = arma::mat
164 ActivationFunction, InputDataType, OutputDataType>;
171 typename InputDataType = arma::mat,
172 typename OutputDataType = arma::mat
175 ActivationFunction, InputDataType, OutputDataType>;
182 typename InputDataType = arma::mat,
183 typename OutputDataType = arma::mat
186 ActivationFunction, InputDataType, OutputDataType>;
193 typename InputDataType = arma::mat,
194 typename OutputDataType = arma::mat
197 ActivationFunction, InputDataType, OutputDataType>;
204 typename InputDataType = arma::mat,
205 typename OutputDataType = arma::mat
208 ActivationFunction, InputDataType, OutputDataType>;
214 class ActivationFunction = MishFunction,
215 typename InputDataType = arma::mat,
216 typename OutputDataType = arma::mat
219 ActivationFunction, InputDataType, OutputDataType>;
226 typename InputDataType = arma::mat,
227 typename OutputDataType = arma::mat
230 ActivationFunction, InputDataType, OutputDataType>;
237 typename InputDataType = arma::mat,
238 typename OutputDataType = arma::mat
241 ActivationFunction, InputDataType, OutputDataType>;
248 typename InputDataType = arma::mat,
249 typename OutputDataType = arma::mat
252 ActivationFunction, InputDataType, OutputDataType>;
The identity function, defined by.
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 & OutputParameter()
Modify the output parameter.
BaseLayer()
Create the BaseLayer object.
The LiSHT function, defined by.
OutputDataType & Delta()
Modify the delta.
void Backward(const arma::Mat< eT > &input, const arma::Mat< eT > &gy, arma::Mat< eT > &g)
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backw...
void serialize(Archive &, const unsigned int)
Serialize the layer.
The tanh function, defined by.
The core includes that mlpack expects; standard C++ includes and Armadillo.
The ELiSH function, defined by.
OutputDataType const & OutputParameter() const
Get the output parameter.
OutputDataType const & Delta() const
Get the delta.
Implementation of the base layer.
The logistic function, defined by.
The swish function, defined by.
The softplus function, defined by.
The hard sigmoid function, defined by.
The GELU function, defined by.
The rectifier function, defined by.