13 #ifndef MLPACK_METHODS_ANN_LAYER_LOOKUP_HPP 14 #define MLPACK_METHODS_ANN_LAYER_LOOKUP_HPP 32 typename InputDataType = arma::mat,
33 typename OutputDataType = arma::mat
45 Lookup(
const size_t inSize = 0,
const size_t outSize = 0);
55 void Forward(
const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
67 void Backward(
const arma::Mat<eT>&& ,
68 const arma::Mat<eT>&& gy,
79 void Gradient(
const arma::Mat<eT>&& input,
80 arma::Mat<eT>&& error,
81 arma::Mat<eT>&& gradient);
84 OutputDataType
const&
Parameters()
const {
return weights; }
94 OutputDataType
const&
Delta()
const {
return delta; }
96 OutputDataType&
Delta() {
return delta; }
99 OutputDataType
const&
Gradient()
const {
return gradient; }
106 template<
typename Archive>
107 void serialize(Archive& ar,
const unsigned int );
117 OutputDataType weights;
120 OutputDataType delta;
123 OutputDataType gradient;
126 OutputDataType outputParameter;
130 template<
typename MatType = arma::mat>
137 #include "lookup_impl.hpp"
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 & Gradient() const
Get the gradient.
The core includes that mlpack expects; standard C++ includes and Armadillo.
OutputDataType & Parameters()
Modify the parameters.
Lookup(const size_t inSize=0, const size_t outSize=0)
Create the Lookup object using the specified number of input and output units.
OutputDataType const & Delta() const
Get the delta.
Implementation of the Lookup class.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType & OutputParameter()
Modify the output parameter.
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 const & Parameters() const
Get the parameters.
OutputDataType & Gradient()
Modify the gradient.
OutputDataType & Delta()
Modify the delta.
OutputDataType const & OutputParameter() const
Get the output parameter.