\section{Constant$<$ Input\+Data\+Type, Output\+Data\+Type $>$ Class Template Reference}
\label{classmlpack_1_1ann_1_1Constant}\index{Constant$<$ Input\+Data\+Type, Output\+Data\+Type $>$@{Constant$<$ Input\+Data\+Type, Output\+Data\+Type $>$}}


Implementation of the constant layer.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Constant} (const size\+\_\+t out\+Size=0, const double scalar=0.\+0)
\begin{DoxyCompactList}\small\item\em Create the \doxyref{Constant}{p.}{classmlpack_1_1ann_1_1Constant} object that outputs a given constant scalar value given any input value. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Data\+Type $>$ }\\void \textbf{ Backward} (const Data\+Type \&, const Data\+Type \&, Data\+Type \&g)
\begin{DoxyCompactList}\small\item\em Ordinary feed backward pass of a neural network. \end{DoxyCompactList}\item 
Output\+Data\+Type \& \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 
{\footnotesize template$<$typename Input\+Type , typename Output\+Type $>$ }\\void \textbf{ Forward} (const Input\+Type \&input, Output\+Type \&output)
\begin{DoxyCompactList}\small\item\em Ordinary feed forward pass of a neural network. \end{DoxyCompactList}\item 
Output\+Data\+Type \& \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 
{\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$>$\newline
class mlpack\+::ann\+::\+Constant$<$ Input\+Data\+Type, Output\+Data\+Type $>$}

Implementation of the constant layer. 

The constant layer outputs a given constant value given any input value.


\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 34 of file constant.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1ann_1_1Constant_a320d5aa3ea2b58fceb9c409abe0a4050}} 
\index{mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}!Constant@{Constant}}
\index{Constant@{Constant}!mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}}
\subsubsection{Constant()}
{\footnotesize\ttfamily \textbf{ Constant} (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{out\+Size = {\ttfamily 0},  }\item[{const double}]{scalar = {\ttfamily 0.0} }\end{DoxyParamCaption})}



Create the \doxyref{Constant}{p.}{classmlpack_1_1ann_1_1Constant} object that outputs a given constant scalar value given any input value. 


\begin{DoxyParams}{Parameters}
{\em out\+Size} & The number of output units. \\
\hline
{\em scalar} & The constant value used to create the constant output. \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1ann_1_1Constant_aed454f26a963127d9027c95485dcc695}} 
\index{mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}!Backward@{Backward}}
\index{Backward@{Backward}!mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}}
\subsubsection{Backward()}
{\footnotesize\ttfamily void Backward (\begin{DoxyParamCaption}\item[{const Data\+Type \&}]{,  }\item[{const Data\+Type \&}]{,  }\item[{Data\+Type \&}]{g }\end{DoxyParamCaption})}



Ordinary feed backward pass of a neural network. 

The backward pass of the constant layer is returns always a zero output error matrix.


\begin{DoxyParams}{Parameters}
{\em 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_1Constant_ae7c8eba5764f021cd93e30efe638e63c}} 
\index{mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}!Delta@{Delta}}
\index{Delta@{Delta}!mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}}
\subsubsection{Delta()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Output\+Data\+Type\& Delta (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the delta. 



Definition at line 75 of file constant.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Constant_ad6601342d560219ce951d554e69e5e87}} 
\index{mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}!Delta@{Delta}}
\index{Delta@{Delta}!mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}}
\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 77 of file constant.\+hpp.



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

\mbox{\label{classmlpack_1_1ann_1_1Constant_a09440df0a90bdcc766e56e097d91205b}} 
\index{mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}!Forward@{Forward}}
\index{Forward@{Forward}!mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}}
\subsubsection{Forward()}
{\footnotesize\ttfamily void Forward (\begin{DoxyParamCaption}\item[{const Input\+Type \&}]{input,  }\item[{Output\+Type \&}]{output }\end{DoxyParamCaption})}



Ordinary feed forward pass of a neural network. 

The forward pass fills the output with the specified constant parameter.


\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_1Constant_a8bae962cc603d1cab8d80ec78f8d505d}} 
\index{mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}!Output\+Parameter@{Output\+Parameter}}
\index{Output\+Parameter@{Output\+Parameter}!mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}}
\subsubsection{Output\+Parameter()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Output\+Data\+Type\& Output\+Parameter (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the output parameter. 



Definition at line 70 of file constant.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Constant_a21d5f745f02c709625a4ee0907f004a5}} 
\index{mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}!Output\+Parameter@{Output\+Parameter}}
\index{Output\+Parameter@{Output\+Parameter}!mlpack\+::ann\+::\+Constant@{mlpack\+::ann\+::\+Constant}}
\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 72 of file constant.\+hpp.

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



Serialize the layer. 



Referenced by Constant$<$ Input\+Data\+Type, Output\+Data\+Type $>$\+::\+Delta().



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