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);
68 const arma::Mat<eT>& gy,
79 void Gradient(
const arma::Mat<eT>& input,
80 const 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; }
112 template<
typename Archive>
113 void serialize(Archive& ar,
const unsigned int );
123 OutputDataType weights;
126 OutputDataType delta;
129 OutputDataType gradient;
132 OutputDataType outputParameter;
136 template<
typename MatType = arma::mat>
143 #include "lookup_impl.hpp"
Linear algebra utility functions, generally performed on matrices or vectors.
OutputDataType const & Gradient() const
Get the gradient.
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t InSize() const
Get the number of input units.
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 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...
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType & OutputParameter()
Modify the output parameter.
size_t OutSize() const
Get the number of output units.
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 & Parameters() const
Get the parameters.
OutputDataType & Gradient()
Modify the gradient.
OutputDataType & Delta()
Modify the delta.
OutputDataType const & OutputParameter() const
Get the output parameter.