13 #ifndef MLPACK_METHODS_ANN_LAYER_LINEAR_HPP 14 #define MLPACK_METHODS_ANN_LAYER_LINEAR_HPP 33 typename InputDataType = arma::mat,
34 typename OutputDataType = arma::mat
48 Linear(
const size_t inSize,
const size_t outSize);;
63 void Forward(
const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
75 void Backward(
const arma::Mat<eT>&& ,
87 void Gradient(
const arma::Mat<eT>&& input,
88 arma::Mat<eT>&& error,
89 arma::Mat<eT>&& gradient);
92 OutputDataType
const&
Parameters()
const {
return weights; }
107 OutputDataType
const&
Delta()
const {
return delta; }
109 OutputDataType&
Delta() {
return delta; }
112 OutputDataType
const&
Gradient()
const {
return gradient; }
119 template<
typename Archive>
120 void serialize(Archive& ar,
const unsigned int );
130 OutputDataType weights;
133 OutputDataType weight;
139 OutputDataType delta;
142 OutputDataType gradient;
145 InputDataType inputParameter;
148 OutputDataType outputParameter;
155 #include "linear_impl.hpp" void serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType const & Delta() const
Get the delta.
void Backward(const arma::Mat< eT > &&, 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 & Parameters()
Modify the parameters.
The core includes that mlpack expects; standard C++ includes and Armadillo.
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 & Gradient()
Modify the gradient.
OutputDataType const & Gradient() const
Get the gradient.
OutputDataType const & Parameters() const
Get the parameters.
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType const & OutputParameter() const
Get the output parameter.
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType & Delta()
Modify the delta.
Linear()
Create the Linear object.
InputDataType const & InputParameter() const
Get the input parameter.