13 #ifndef MLPACK_METHODS_ANN_LAYER_LINEAR_HPP 14 #define MLPACK_METHODS_ANN_LAYER_LINEAR_HPP 34 typename InputDataType = arma::mat,
35 typename OutputDataType = arma::mat,
36 typename RegularizerType = NoRegularizer
50 Linear(
const size_t inSize,
52 RegularizerType regularizer = RegularizerType());
67 void Forward(
const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
79 void Backward(
const arma::Mat<eT>&& ,
91 void Gradient(
const arma::Mat<eT>&& input,
92 arma::Mat<eT>&& error,
93 arma::Mat<eT>&& gradient);
96 OutputDataType
const&
Parameters()
const {
return weights; }
111 OutputDataType
const&
Delta()
const {
return delta; }
113 OutputDataType&
Delta() {
return delta; }
122 OutputDataType
const&
Gradient()
const {
return gradient; }
127 arma::mat&
Bias() {
return bias; }
132 template<
typename Archive>
133 void serialize(Archive& ar,
const unsigned int );
143 OutputDataType weights;
146 OutputDataType weight;
152 OutputDataType delta;
155 OutputDataType gradient;
158 InputDataType inputParameter;
161 OutputDataType outputParameter;
164 RegularizerType regularizer;
171 #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.
size_t OutputSize() const
Get the output size.
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...
arma::mat & Bias()
Modify the bias weights of the layer.
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.
size_t InputSize() const
Get the input size.
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType & Delta()
Modify the delta.
Linear()
Create the Linear object.
InputDataType const & InputParameter() const
Get the input parameter.