\section{Recurrent$<$ Input\+Data\+Type, Output\+Data\+Type, Custom\+Layers $>$ Class Template Reference}
\label{classmlpack_1_1ann_1_1Recurrent}\index{Recurrent$<$ Input\+Data\+Type, Output\+Data\+Type, Custom\+Layers $>$@{Recurrent$<$ Input\+Data\+Type, Output\+Data\+Type, Custom\+Layers $>$}}


Implementation of the Recurrent\+Layer class.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Recurrent} ()
\begin{DoxyCompactList}\small\item\em Default constructor---this will create a \doxyref{Recurrent}{p.}{classmlpack_1_1ann_1_1Recurrent} object that can\textquotesingle{}t be used, so be careful! Make sure to set all the parameters before use. \end{DoxyCompactList}\item 
\textbf{ Recurrent} (const \textbf{ Recurrent} \&)
\begin{DoxyCompactList}\small\item\em Copy constructor. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Start\+Module\+Type , typename Input\+Module\+Type , typename Feedback\+Module\+Type , typename Transfer\+Module\+Type $>$ }\\\textbf{ Recurrent} (const Start\+Module\+Type \&start, const Input\+Module\+Type \&input, const Feedback\+Module\+Type \&feedback, const Transfer\+Module\+Type \&transfer, const size\+\_\+t rho)
\begin{DoxyCompactList}\small\item\em Create the \doxyref{Recurrent}{p.}{classmlpack_1_1ann_1_1Recurrent} object using the specified modules. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename eT $>$ }\\void \textbf{ Backward} (const arma\+::\+Mat$<$ eT $>$ \&, const arma\+::\+Mat$<$ eT $>$ \&gy, arma\+::\+Mat$<$ eT $>$ \&g)
\begin{DoxyCompactList}\small\item\em Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f. \end{DoxyCompactList}\item 
Output\+Data\+Type const  \& \textbf{ Delta} () const
\begin{DoxyCompactList}\small\item\em Get the delta. \end{DoxyCompactList}\item 
Output\+Data\+Type \& \textbf{ Delta} ()
\begin{DoxyCompactList}\small\item\em Modify the delta. \end{DoxyCompactList}\item 
bool \textbf{ Deterministic} () const
\begin{DoxyCompactList}\small\item\em The value of the deterministic parameter. \end{DoxyCompactList}\item 
bool \& \textbf{ Deterministic} ()
\begin{DoxyCompactList}\small\item\em Modify the value of the deterministic parameter. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename eT $>$ }\\void \textbf{ Forward} (const arma\+::\+Mat$<$ eT $>$ \&input, arma\+::\+Mat$<$ eT $>$ \&output)
\begin{DoxyCompactList}\small\item\em Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename eT $>$ }\\void \textbf{ Gradient} (const arma\+::\+Mat$<$ eT $>$ \&input, const arma\+::\+Mat$<$ eT $>$ \&error, arma\+::\+Mat$<$ eT $>$ \&)
\item 
Output\+Data\+Type const  \& \textbf{ Gradient} () const
\begin{DoxyCompactList}\small\item\em Get the gradient. \end{DoxyCompactList}\item 
Output\+Data\+Type \& \textbf{ Gradient} ()
\begin{DoxyCompactList}\small\item\em Modify the gradient. \end{DoxyCompactList}\item 
std\+::vector$<$ \textbf{ Layer\+Types}$<$ Custom\+Layers... $>$ $>$ \& \textbf{ Model} ()
\begin{DoxyCompactList}\small\item\em Get the model modules. \end{DoxyCompactList}\item 
Output\+Data\+Type const  \& \textbf{ Output\+Parameter} () const
\begin{DoxyCompactList}\small\item\em Get the output parameter. \end{DoxyCompactList}\item 
Output\+Data\+Type \& \textbf{ Output\+Parameter} ()
\begin{DoxyCompactList}\small\item\em Modify the output parameter. \end{DoxyCompactList}\item 
Output\+Data\+Type const  \& \textbf{ Parameters} () const
\begin{DoxyCompactList}\small\item\em Get the parameters. \end{DoxyCompactList}\item 
Output\+Data\+Type \& \textbf{ Parameters} ()
\begin{DoxyCompactList}\small\item\em Modify the parameters. \end{DoxyCompactList}\item 
size\+\_\+t const  \& \textbf{ Rho} () const
\begin{DoxyCompactList}\small\item\em Get the number of steps to backpropagate through time. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Archive $>$ }\\void \textbf{ serialize} (Archive \&ar, const unsigned int)
\begin{DoxyCompactList}\small\item\em Serialize the layer. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename Input\+Data\+Type = arma\+::mat, typename Output\+Data\+Type = arma\+::mat, typename... Custom\+Layers$>$\newline
class mlpack\+::ann\+::\+Recurrent$<$ Input\+Data\+Type, Output\+Data\+Type, Custom\+Layers $>$}

Implementation of the Recurrent\+Layer class. 

\doxyref{Recurrent}{p.}{classmlpack_1_1ann_1_1Recurrent} layers can be used similarly to feed-\/forward layers.


\begin{DoxyTemplParams}{Template Parameters}
{\em Input\+Data\+Type} & Type of the input data (arma\+::colvec, arma\+::mat, arma\+::sp\+\_\+mat or arma\+::cube). \\
\hline
{\em Output\+Data\+Type} & Type of the output data (arma\+::colvec, arma\+::mat, arma\+::sp\+\_\+mat or arma\+::cube). \\
\hline
\end{DoxyTemplParams}


Definition at line 136 of file layer\+\_\+types.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a5671131c5430476ae0858dcd20d1de7b}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Recurrent@{Recurrent}}
\index{Recurrent@{Recurrent}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Recurrent()\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily \textbf{ Recurrent} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Default constructor---this will create a \doxyref{Recurrent}{p.}{classmlpack_1_1ann_1_1Recurrent} object that can\textquotesingle{}t be used, so be careful! Make sure to set all the parameters before use. 

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_ac3f5ea76a45873f275c930a315f245ab}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Recurrent@{Recurrent}}
\index{Recurrent@{Recurrent}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Recurrent()\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily \textbf{ Recurrent} (\begin{DoxyParamCaption}\item[{const \textbf{ Recurrent}$<$ Input\+Data\+Type, Output\+Data\+Type, Custom\+Layers $>$ \&}]{ }\end{DoxyParamCaption})}



Copy constructor. 

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a54ecbd61ac94b2a19933ea84bead5de9}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Recurrent@{Recurrent}}
\index{Recurrent@{Recurrent}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Recurrent()\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily \textbf{ Recurrent} (\begin{DoxyParamCaption}\item[{const Start\+Module\+Type \&}]{start,  }\item[{const Input\+Module\+Type \&}]{input,  }\item[{const Feedback\+Module\+Type \&}]{feedback,  }\item[{const Transfer\+Module\+Type \&}]{transfer,  }\item[{const size\+\_\+t}]{rho }\end{DoxyParamCaption})}



Create the \doxyref{Recurrent}{p.}{classmlpack_1_1ann_1_1Recurrent} object using the specified modules. 


\begin{DoxyParams}{Parameters}
{\em start} & The start module. \\
\hline
{\em input} & The input module. \\
\hline
{\em feedback} & The feedback module. \\
\hline
{\em transfer} & The transfer module. \\
\hline
{\em rho} & Maximum number of steps to backpropagate through time (B\+P\+TT). \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1ann_1_1Recurrent_ad9ad1a3bdb0f3fff5c839ed155e4bbf8}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Backward@{Backward}}
\index{Backward@{Backward}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Backward()}
{\footnotesize\ttfamily void Backward (\begin{DoxyParamCaption}\item[{const arma\+::\+Mat$<$ eT $>$ \&}]{,  }\item[{const arma\+::\+Mat$<$ eT $>$ \&}]{gy,  }\item[{arma\+::\+Mat$<$ eT $>$ \&}]{g }\end{DoxyParamCaption})}



Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f. 

Using the results from the feed forward pass.


\begin{DoxyParams}{Parameters}
{\em $\ast$} & (input) The propagated input activation. \\
\hline
{\em gy} & The backpropagated error. \\
\hline
{\em g} & The calculated gradient. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a797f7edb44dd081e5e2b3cc316eef6bd}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Delta@{Delta}}
\index{Delta@{Delta}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Delta()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Output\+Data\+Type const\& Delta (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the delta. 



Definition at line 130 of file recurrent.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_ad6601342d560219ce951d554e69e5e87}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Delta@{Delta}}
\index{Delta@{Delta}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Delta()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily Output\+Data\+Type\& Delta (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the delta. 



Definition at line 132 of file recurrent.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a9f4103707f4d199ce5594d239b60443e}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Deterministic@{Deterministic}}
\index{Deterministic@{Deterministic}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Deterministic()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily bool Deterministic (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



The value of the deterministic parameter. 



Definition at line 115 of file recurrent.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a42d4ee3da432cff20d3a41b8b1ec801c}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Deterministic@{Deterministic}}
\index{Deterministic@{Deterministic}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Deterministic()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily bool\& Deterministic (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the value of the deterministic parameter. 



Definition at line 117 of file recurrent.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a461f849bc638c15bec262dc9c3a58abe}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Forward@{Forward}}
\index{Forward@{Forward}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Forward()}
{\footnotesize\ttfamily void Forward (\begin{DoxyParamCaption}\item[{const arma\+::\+Mat$<$ eT $>$ \&}]{input,  }\item[{arma\+::\+Mat$<$ eT $>$ \&}]{output }\end{DoxyParamCaption})}



Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. 


\begin{DoxyParams}{Parameters}
{\em input} & Input data used for evaluating the specified function. \\
\hline
{\em output} & Resulting output activation. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a505acb56ef67da2fc73190d3d4931969}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Gradient@{Gradient}}
\index{Gradient@{Gradient}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Gradient()\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily void Gradient (\begin{DoxyParamCaption}\item[{const arma\+::\+Mat$<$ eT $>$ \&}]{input,  }\item[{const arma\+::\+Mat$<$ eT $>$ \&}]{error,  }\item[{arma\+::\+Mat$<$ eT $>$ \&}]{ }\end{DoxyParamCaption})}

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a0f1f4e6d93472d83852731a96c8c3f59}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Gradient@{Gradient}}
\index{Gradient@{Gradient}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Gradient()\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily Output\+Data\+Type const\& Gradient (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the gradient. 



Definition at line 135 of file recurrent.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a19abce4739c3b0b658b612537e21956a}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Gradient@{Gradient}}
\index{Gradient@{Gradient}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Gradient()\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily Output\+Data\+Type\& Gradient (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the gradient. 



Definition at line 137 of file recurrent.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a4cb1e93bff99ccf1f8f974065a3b13c3}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Model@{Model}}
\index{Model@{Model}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Model()}
{\footnotesize\ttfamily std\+::vector$<$\textbf{ Layer\+Types}$<$Custom\+Layers...$>$ $>$\& Model (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Get the model modules. 



Definition at line 112 of file recurrent.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a0ee21c2a36e5abad1e7a9d5dd00849f9}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Output\+Parameter@{Output\+Parameter}}
\index{Output\+Parameter@{Output\+Parameter}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Output\+Parameter()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Output\+Data\+Type const\& Output\+Parameter (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the output parameter. 



Definition at line 125 of file recurrent.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a21d5f745f02c709625a4ee0907f004a5}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Output\+Parameter@{Output\+Parameter}}
\index{Output\+Parameter@{Output\+Parameter}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Output\+Parameter()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily Output\+Data\+Type\& Output\+Parameter (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the output parameter. 



Definition at line 127 of file recurrent.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_aa530552c7ef915c952fbacc77b965c90}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Parameters@{Parameters}}
\index{Parameters@{Parameters}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Parameters()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Output\+Data\+Type const\& Parameters (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the parameters. 



Definition at line 120 of file recurrent.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_a9c5c5900772a689d5a6b59778ec67120}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Parameters@{Parameters}}
\index{Parameters@{Parameters}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Parameters()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily Output\+Data\+Type\& Parameters (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the parameters. 



Definition at line 122 of file recurrent.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_aae052295a422d4030c3eacfc1255b1b6}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!Rho@{Rho}}
\index{Rho@{Rho}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{Rho()}
{\footnotesize\ttfamily size\+\_\+t const\& Rho (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the number of steps to backpropagate through time. 



Definition at line 140 of file recurrent.\+hpp.



References Recurrent$<$ Input\+Data\+Type, Output\+Data\+Type, Custom\+Layers $>$\+::serialize().

\mbox{\label{classmlpack_1_1ann_1_1Recurrent_af0dd9205158ccf7bcfcd8ff81f79c927}} 
\index{mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}!serialize@{serialize}}
\index{serialize@{serialize}!mlpack\+::ann\+::\+Recurrent@{mlpack\+::ann\+::\+Recurrent}}
\subsubsection{serialize()}
{\footnotesize\ttfamily void serialize (\begin{DoxyParamCaption}\item[{Archive \&}]{ar,  }\item[{const unsigned}]{int }\end{DoxyParamCaption})}



Serialize the layer. 



Referenced by Recurrent$<$ Input\+Data\+Type, Output\+Data\+Type, Custom\+Layers $>$\+::\+Rho().



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
/var/www/mlpack.\+ratml.\+org/mlpack.\+org/\+\_\+src/mlpack-\/3.\+3.\+2/src/mlpack/methods/ann/layer/\textbf{ layer\+\_\+types.\+hpp}\item 
/var/www/mlpack.\+ratml.\+org/mlpack.\+org/\+\_\+src/mlpack-\/3.\+3.\+2/src/mlpack/methods/ann/layer/\textbf{ recurrent.\+hpp}\end{DoxyCompactItemize}
