13 #ifndef MLPACK_METHODS_ANN_LAYER_BASE_LAYER_HPP 14 #define MLPACK_METHODS_ANN_LAYER_BASE_LAYER_HPP 65 class ActivationFunction = LogisticFunction,
66 typename InputDataType = arma::mat,
67 typename OutputDataType = arma::mat
87 template<
typename InputType,
typename OutputType>
88 void Forward(
const InputType& input, OutputType& output)
90 ActivationFunction::Fn(input, output);
102 template<
typename eT>
104 const arma::Mat<eT>& gy,
107 arma::Mat<eT> derivative;
108 ActivationFunction::Deriv(input, derivative);
118 OutputDataType
const&
Delta()
const {
return delta; }
120 OutputDataType&
Delta() {
return delta; }
125 template<
typename Archive>
133 OutputDataType delta;
136 OutputDataType outputParameter;
146 typename InputDataType = arma::mat,
147 typename OutputDataType = arma::mat
150 ActivationFunction, InputDataType, OutputDataType>;
157 typename InputDataType = arma::mat,
158 typename OutputDataType = arma::mat
161 ActivationFunction, InputDataType, OutputDataType>;
168 typename InputDataType = arma::mat,
169 typename OutputDataType = arma::mat
172 ActivationFunction, InputDataType, OutputDataType>;
179 typename InputDataType = arma::mat,
180 typename OutputDataType = arma::mat
183 ActivationFunction, InputDataType, OutputDataType>;
190 typename InputDataType = arma::mat,
191 typename OutputDataType = arma::mat
194 ActivationFunction, InputDataType, OutputDataType>;
201 typename InputDataType = arma::mat,
202 typename OutputDataType = arma::mat
205 ActivationFunction, InputDataType, OutputDataType>;
212 typename InputDataType = arma::mat,
213 typename OutputDataType = arma::mat
216 ActivationFunction, InputDataType, OutputDataType>;
223 typename InputDataType = arma::mat,
224 typename OutputDataType = arma::mat
227 ActivationFunction, InputDataType, OutputDataType>;
234 typename InputDataType = arma::mat,
235 typename OutputDataType = arma::mat
238 ActivationFunction, InputDataType, OutputDataType>;
245 typename InputDataType = arma::mat,
246 typename OutputDataType = arma::mat
249 ActivationFunction, InputDataType, OutputDataType>;
256 typename InputDataType = arma::mat,
257 typename OutputDataType = arma::mat
260 ActivationFunction, InputDataType, OutputDataType>;
267 typename InputDataType = arma::mat,
268 typename OutputDataType = arma::mat
271 ActivationFunction, InputDataType, OutputDataType>;
278 typename InputDataType = arma::mat,
279 typename OutputDataType = arma::mat
282 ActivationFunction, InputDataType, OutputDataType>;
289 typename InputDataType = arma::mat,
290 typename OutputDataType = arma::mat
293 ActivationFunction, InputDataType, OutputDataType>;
300 typename InputDataType = arma::mat,
301 typename OutputDataType = arma::mat
304 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 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.