\section{C\+E\+LU$<$ Input\+Data\+Type, Output\+Data\+Type $>$ Class Template Reference}
\label{classmlpack_1_1ann_1_1CELU}\index{C\+E\+L\+U$<$ Input\+Data\+Type, Output\+Data\+Type $>$@{C\+E\+L\+U$<$ Input\+Data\+Type, Output\+Data\+Type $>$}}


The \doxyref{C\+E\+LU}{p.}{classmlpack_1_1ann_1_1CELU} activation function, defined by.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ C\+E\+LU} (const double alpha=1.\+0)
\begin{DoxyCompactList}\small\item\em Create the \doxyref{C\+E\+LU}{p.}{classmlpack_1_1ann_1_1CELU} object using the specified parameter. \end{DoxyCompactList}\item 
double const  \& \textbf{ Alpha} () const
\begin{DoxyCompactList}\small\item\em Get the non zero gradient. \end{DoxyCompactList}\item 
double \& \textbf{ Alpha} ()
\begin{DoxyCompactList}\small\item\em Modify the non zero gradient. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Data\+Type $>$ }\\void \textbf{ Backward} (const Data\+Type \&input, const Data\+Type \&gy, Data\+Type \&g)
\begin{DoxyCompactList}\small\item\em Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards through 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 Get the value of deterministic parameter. \end{DoxyCompactList}\item 
bool \& \textbf{ Deterministic} ()
\begin{DoxyCompactList}\small\item\em Modify the value of deterministic parameter. \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, evaluating the function f(x) by propagating the activity forward through f. \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 
{\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\+::\+C\+E\+L\+U$<$ Input\+Data\+Type, Output\+Data\+Type $>$}

The \doxyref{C\+E\+LU}{p.}{classmlpack_1_1ann_1_1CELU} activation function, defined by. 

\begin{eqnarray*} f(x) &=& \left\{ \begin{array}{lr} x & : x \ge 0 \\ \alpha(e^(\frac{x}{\alpha}) - 1) & : x < 0 \end{array} \right. \\ f'(x) &=& \left\{ \begin{array}{lr} 1 & : x \ge 0 \\ (\frac{f(x)}{\alpha}) + 1 & : x < 0 \end{array} \right. \end{eqnarray*}

In the deterministic mode, there is no computation of the derivative.


\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 60 of file celu.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1ann_1_1CELU_acbf1067f015ef69764b73b35ad0e2f53}} 
\index{mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}!C\+E\+LU@{C\+E\+LU}}
\index{C\+E\+LU@{C\+E\+LU}!mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}}
\subsubsection{C\+E\+L\+U()}
{\footnotesize\ttfamily \textbf{ C\+E\+LU} (\begin{DoxyParamCaption}\item[{const double}]{alpha = {\ttfamily 1.0} }\end{DoxyParamCaption})}



Create the \doxyref{C\+E\+LU}{p.}{classmlpack_1_1ann_1_1CELU} object using the specified parameter. 

The non zero gradient for negative inputs can be adjusted by specifying the \doxyref{C\+E\+LU}{p.}{classmlpack_1_1ann_1_1CELU} hyperparameter alpha (alpha $>$ 0).


\begin{DoxyParams}{Parameters}
{\em alpha} & Scale parameter for the negative factor (default = 1.\+0). \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1ann_1_1CELU_a21679485637bdec3078ec74d71572980}} 
\index{mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}!Alpha@{Alpha}}
\index{Alpha@{Alpha}!mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}}
\subsubsection{Alpha()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily double const\& Alpha (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the non zero gradient. 



Definition at line 105 of file celu.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1CELU_acbb0e4747a3a307bee88bad71e5eeaf1}} 
\index{mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}!Alpha@{Alpha}}
\index{Alpha@{Alpha}!mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}}
\subsubsection{Alpha()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily double\& Alpha (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the non zero gradient. 



Definition at line 107 of file celu.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1CELU_aef8c56f1f8624bd006afec8b3bcda9d6}} 
\index{mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}!Backward@{Backward}}
\index{Backward@{Backward}!mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}}
\subsubsection{Backward()}
{\footnotesize\ttfamily void Backward (\begin{DoxyParamCaption}\item[{const Data\+Type \&}]{input,  }\item[{const Data\+Type \&}]{gy,  }\item[{Data\+Type \&}]{g }\end{DoxyParamCaption})}



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

Using the results from the feed forward pass.


\begin{DoxyParams}{Parameters}
{\em input} & The propagated input activation f(x). \\
\hline
{\em gy} & The backpropagated error. \\
\hline
{\em g} & The calculated gradient. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1ann_1_1CELU_a797f7edb44dd081e5e2b3cc316eef6bd}} 
\index{mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}!Delta@{Delta}}
\index{Delta@{Delta}!mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}}
\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 100 of file celu.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1CELU_ad6601342d560219ce951d554e69e5e87}} 
\index{mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}!Delta@{Delta}}
\index{Delta@{Delta}!mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}}
\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 102 of file celu.\+hpp.

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



Get the value of deterministic parameter. 



Definition at line 110 of file celu.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1CELU_a42d4ee3da432cff20d3a41b8b1ec801c}} 
\index{mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}!Deterministic@{Deterministic}}
\index{Deterministic@{Deterministic}!mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}}
\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 deterministic parameter. 



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



References C\+E\+L\+U$<$ Input\+Data\+Type, Output\+Data\+Type $>$\+::serialize().

\mbox{\label{classmlpack_1_1ann_1_1CELU_a09440df0a90bdcc766e56e097d91205b}} 
\index{mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}!Forward@{Forward}}
\index{Forward@{Forward}!mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}}
\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, 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_1CELU_a0ee21c2a36e5abad1e7a9d5dd00849f9}} 
\index{mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}!Output\+Parameter@{Output\+Parameter}}
\index{Output\+Parameter@{Output\+Parameter}!mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}}
\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 95 of file celu.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1CELU_a21d5f745f02c709625a4ee0907f004a5}} 
\index{mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}!Output\+Parameter@{Output\+Parameter}}
\index{Output\+Parameter@{Output\+Parameter}!mlpack\+::ann\+::\+C\+E\+LU@{mlpack\+::ann\+::\+C\+E\+LU}}
\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 97 of file celu.\+hpp.

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



Serialize the layer. 



Referenced by C\+E\+L\+U$<$ Input\+Data\+Type, Output\+Data\+Type $>$\+::\+Deterministic().



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