13 #ifndef MLPACK_METHODS_ANN_LAYER_BASE_LAYER_HPP 14 #define MLPACK_METHODS_ANN_LAYER_BASE_LAYER_HPP 67 class ActivationFunction = LogisticFunction,
68 typename InputDataType = arma::mat,
69 typename OutputDataType = arma::mat
89 template<
typename InputType,
typename OutputType>
90 void Forward(
const InputType& input, OutputType& output)
92 ActivationFunction::Fn(input, output);
104 template<
typename eT>
106 const arma::Mat<eT>& gy,
109 arma::Mat<eT> derivative;
110 ActivationFunction::Deriv(input, derivative);
120 OutputDataType
const&
Delta()
const {
return delta; }
122 OutputDataType&
Delta() {
return delta; }
127 template<
typename Archive>
135 OutputDataType delta;
138 OutputDataType outputParameter;
148 typename InputDataType = arma::mat,
149 typename OutputDataType = arma::mat
152 ActivationFunction, InputDataType, OutputDataType>;
159 typename InputDataType = arma::mat,
160 typename OutputDataType = arma::mat
163 ActivationFunction, InputDataType, OutputDataType>;
170 typename InputDataType = arma::mat,
171 typename OutputDataType = arma::mat
174 ActivationFunction, InputDataType, OutputDataType>;
181 typename InputDataType = arma::mat,
182 typename OutputDataType = arma::mat
185 ActivationFunction, InputDataType, OutputDataType>;
192 typename InputDataType = arma::mat,
193 typename OutputDataType = arma::mat
196 ActivationFunction, InputDataType, OutputDataType>;
203 typename InputDataType = arma::mat,
204 typename OutputDataType = arma::mat
207 ActivationFunction, InputDataType, OutputDataType>;
214 typename InputDataType = arma::mat,
215 typename OutputDataType = arma::mat
218 ActivationFunction, InputDataType, OutputDataType>;
225 typename InputDataType = arma::mat,
226 typename OutputDataType = arma::mat
229 ActivationFunction, InputDataType, OutputDataType>;
236 typename InputDataType = arma::mat,
237 typename OutputDataType = arma::mat
240 ActivationFunction, InputDataType, OutputDataType>;
247 typename InputDataType = arma::mat,
248 typename OutputDataType = arma::mat
251 ActivationFunction, InputDataType, OutputDataType>;
258 typename InputDataType = arma::mat,
259 typename OutputDataType = arma::mat
262 ActivationFunction, InputDataType, OutputDataType>;
269 typename InputDataType = arma::mat,
270 typename OutputDataType = arma::mat
273 ActivationFunction, InputDataType, OutputDataType>;
280 typename InputDataType = arma::mat,
281 typename OutputDataType = arma::mat
284 ActivationFunction, InputDataType, OutputDataType>;
291 typename InputDataType = arma::mat,
292 typename OutputDataType = arma::mat
295 ActivationFunction, InputDataType, OutputDataType>;
302 typename InputDataType = arma::mat,
303 typename OutputDataType = arma::mat
306 ActivationFunction, InputDataType, OutputDataType>;
313 typename InputDataType = arma::mat,
314 typename OutputDataType = arma::mat
317 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...
The Hard Swish function, defined by.
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...
The tanh function, defined by.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void serialize(Archive &, const uint32_t)
Serialize the layer.
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 SILU function, defined by.
The Mish function, defined by.
The TanhExp function, defined by.
The logistic function, defined by.
The gaussian function, defined by.
The Elliot 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.