12#ifndef MLPACK_METHODS_ANN_LAYER_ADD_HPP
13#define MLPACK_METHODS_ANN_LAYER_ADD_HPP
31 typename InputDataType = arma::mat,
32 typename OutputDataType = arma::mat
42 Add(
const size_t outSize = 0);
52 void Forward(
const arma::Mat<eT>& input, arma::Mat<eT>& output);
65 const arma::Mat<eT>& gy,
77 const arma::Mat<eT>& error,
78 arma::Mat<eT>& gradient);
81 OutputDataType
const&
Parameters()
const {
return weights; }
91 OutputDataType
const&
Delta()
const {
return delta; }
93 OutputDataType&
Delta() {
return delta; }
96 OutputDataType
const&
Gradient()
const {
return gradient; }
98 OutputDataType&
Gradient() {
return gradient; }
109 template<
typename Archive>
117 OutputDataType weights;
120 OutputDataType delta;
123 OutputDataType gradient;
126 OutputDataType outputParameter;
133#include "add_impl.hpp"
Implementation of the Add module class.
OutputDataType const & Delta() const
Get the delta.
OutputDataType const & Parameters() const
Get the parameters.
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &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.
size_t WeightSize() const
Get the size of weights.
size_t OutputSize() const
Get the output size.
void Gradient(const arma::Mat< eT > &, const arma::Mat< eT > &error, arma::Mat< eT > &gradient)
Calculate the gradient using the output delta and the input activation.
OutputDataType const & Gradient() const
Get the gradient.
OutputDataType & Gradient()
Modify the gradient.
void Backward(const arma::Mat< eT > &, 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...
OutputDataType & OutputParameter()
Modify the output parameter.
Add(const size_t outSize=0)
Create the Add object using the specified number of output units.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType & Parameters()
Modify the parameters.
OutputDataType & Delta()
Modify the delta.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.