27 #ifndef MLPACK_METHODS_ANN_LAYER_GRU_HPP 28 #define MLPACK_METHODS_ANN_LAYER_GRU_HPP 53 typename InputType = arma::mat,
54 typename OutputType = arma::mat
56 class GRU :
public Layer<InputType, OutputType>
69 GRU(
const size_t inSize,
80 void Forward(
const InputType& input, OutputType& output);
102 void Gradient(
const InputType& input,
115 size_t Rho()
const {
return rho; }
117 size_t&
Rho() {
return rho; }
125 std::vector<Layer<InputType, OutputType>*>&
Model() {
return network; }
142 template<
typename Archive>
143 void serialize(Archive& ar,
const uint32_t );
180 std::vector<Layer<InputType, OutputType>*> network;
192 std::list<OutputType> outParameter;
198 typename std::list<OutputType>::iterator prevOutput;
201 typename std::list<OutputType>::iterator backIterator;
204 typename std::list<OutputType>::iterator gradIterator;
207 OutputType prevError;
219 OutputType outputParameter;
226 #include "gru_impl.hpp" OutputType const & Parameters() const
Get the parameters.
void ResetCell(const size_t size)
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
constexpr auto size(Container const &container) noexcept -> decltype(container.size())
Linear algebra utility functions, generally performed on matrices or vectors.
size_t InputShape() const
Get the shape of the input.
The core includes that mlpack expects; standard C++ includes and Armadillo.
std::vector< Layer< InputType, OutputType > * > & Model()
Get the model modules.
void Backward(const InputType &, const OutputType &gy, OutputType &g)
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backw...
OutputType & Parameters()
Modify the parameters.
size_t OutSize() const
Get the number of output units.
constexpr T const & max(T const &lhs, T const &rhs)
size_t Rho() const
Get the maximum number of steps to backpropagate through time (BPTT).
void Gradient(const InputType &input, const OutputType &, OutputType &)
GRU()
Create the GRU object.
An implementation of a gru network layer.
size_t InSize() const
Get the number of input units.
A layer is an abstract class implementing common neural networks operations, such as convolution...
void Forward(const InputType &input, OutputType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
size_t & Rho()
Modify the maximum number of steps to backpropagate through time (BPTT).