12 #ifndef MLPACK_METHODS_ANN_LAYER_LSTM_HPP
13 #define MLPACK_METHODS_ANN_LAYER_LSTM_HPP
59 typename InputDataType = arma::mat,
60 typename OutputDataType = arma::mat
77 const size_t rho = std::numeric_limits<size_t>::max());
86 template<
typename InputType,
typename OutputType>
87 void Forward(
const InputType& input, OutputType& output);
98 template<
typename InputType,
typename OutputType>
101 OutputType& cellState,
102 bool useCellState =
false);
113 template<
typename InputType,
typename ErrorType,
typename GradientType>
138 template<
typename InputType,
typename ErrorType,
typename GradientType>
140 const ErrorType& error,
141 GradientType& gradient);
144 size_t Rho()
const {
return rho; }
146 size_t&
Rho() {
return rho; }
159 OutputDataType
const&
Delta()
const {
return delta; }
161 OutputDataType&
Delta() {
return delta; }
164 OutputDataType
const&
Gradient()
const {
return grad; }
177 template<
typename Archive>
200 OutputDataType weights;
203 OutputDataType prevOutput;
213 size_t gradientStepIdx;
216 OutputDataType cellActivationError;
219 OutputDataType delta;
225 OutputDataType outputParameter;
228 OutputDataType output2GateInputWeight;
231 OutputDataType input2GateInputWeight;
234 OutputDataType input2GateInputBias;
237 OutputDataType cell2GateInputWeight;
240 OutputDataType output2GateForgetWeight;
243 OutputDataType input2GateForgetWeight;
246 OutputDataType input2GateForgetBias;
249 OutputDataType cell2GateForgetWeight;
252 OutputDataType output2GateOutputWeight;
255 OutputDataType input2GateOutputWeight;
258 OutputDataType input2GateOutputBias;
261 OutputDataType cell2GateOutputWeight;
264 OutputDataType inputGate;
267 OutputDataType forgetGate;
270 OutputDataType hiddenLayer;
273 OutputDataType outputGate;
276 OutputDataType inputGateActivation;
279 OutputDataType forgetGateActivation;
282 OutputDataType outputGateActivation;
285 OutputDataType hiddenLayerActivation;
288 OutputDataType input2HiddenWeight;
291 OutputDataType input2HiddenBias;
294 OutputDataType output2HiddenWeight;
300 OutputDataType cellActivation;
303 OutputDataType forgetGateError;
306 OutputDataType outputGateError;
309 OutputDataType prevError;
312 OutputDataType outParameter;
315 OutputDataType inputCellError;
318 OutputDataType inputGateError;
321 OutputDataType hiddenError;
334 #include "lstm_impl.hpp"