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.
Definition: identity_function.hpp:28
The Hard Swish function, defined by.
Definition: hard_swish_function.hpp:47
The LiSHT function, defined by.
Definition: lisht_function.hpp:42
The tanh function, defined by.
Definition: tanh_function.hpp:29
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.
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...
Definition: base_layer.hpp:105
The ELiSH function, defined by.
Definition: elish_function.hpp:48
Implementation of the base layer.
Definition: base_layer.hpp:71
The SILU function, defined by.
Definition: silu_function.hpp:43
OutputDataType const & Delta() const
Get the delta.
Definition: base_layer.hpp:120
The Mish function, defined by.
Definition: mish_function.hpp:40
The TanhExp function, defined by.
Definition: tanh_exponential_function.hpp:42
The logistic function, defined by.
Definition: logistic_function.hpp:29
The gaussian function, defined by.
Definition: gaussian_function.hpp:28
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
Definition: base_layer.hpp:90
The Elliot function, defined by.
Definition: elliot_function.hpp:40
void serialize(Archive &, const uint32_t)
Serialize the layer.
Definition: base_layer.hpp:128
The swish function, defined by.
Definition: swish_function.hpp:30
BaseLayer()
Create the BaseLayer object.
Definition: base_layer.hpp:77
The softplus function, defined by.
Definition: softplus_function.hpp:43
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: base_layer.hpp:115
The hard sigmoid function, defined by.
Definition: hard_sigmoid_function.hpp:34
The GELU function, defined by.
Definition: gelu_function.hpp:31
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: base_layer.hpp:117
The rectifier function, defined by.
Definition: rectifier_function.hpp:45
OutputDataType & Delta()
Modify the delta.
Definition: base_layer.hpp:122