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


Implementation of the \doxyref{Softmax}{p.}{classmlpack_1_1ann_1_1Softmax} layer.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Softmax} ()
\begin{DoxyCompactList}\small\item\em Create the \doxyref{Softmax}{p.}{classmlpack_1_1ann_1_1Softmax} object. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename eT $>$ }\\void \textbf{ Backward} (const arma\+::\+Mat$<$ eT $>$ \&input, 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 through f. \end{DoxyCompactList}\item 
Input\+Data\+Type \& \textbf{ Delta} () const
\begin{DoxyCompactList}\small\item\em Get the delta. \end{DoxyCompactList}\item 
Input\+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, evaluating the function f(x) by propagating the activity forward through f. \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 \&, 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\+::\+Softmax$<$ Input\+Data\+Type, Output\+Data\+Type $>$}

Implementation of the \doxyref{Softmax}{p.}{classmlpack_1_1ann_1_1Softmax} layer. 

The softmax function takes as input a vector of K real numbers, and normalizes it into a probability distribution consisting of K probabilities proportional to the exponentials of the input numbers. It should be used for inference only and not with N\+LL loss (use \doxyref{Log\+Soft\+Max}{p.}{classmlpack_1_1ann_1_1LogSoftMax} instead).


\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 38 of file softmax.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1ann_1_1Softmax_ada0b97a2580d50b6ea865083b353e2a3}} 
\index{mlpack\+::ann\+::\+Softmax@{mlpack\+::ann\+::\+Softmax}!Softmax@{Softmax}}
\index{Softmax@{Softmax}!mlpack\+::ann\+::\+Softmax@{mlpack\+::ann\+::\+Softmax}}
\subsubsection{Softmax()}
{\footnotesize\ttfamily \textbf{ Softmax} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Create the \doxyref{Softmax}{p.}{classmlpack_1_1ann_1_1Softmax} object. 



\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1ann_1_1Softmax_a78dbad83871f43db1975e45a9a69c376}} 
\index{mlpack\+::ann\+::\+Softmax@{mlpack\+::ann\+::\+Softmax}!Backward@{Backward}}
\index{Backward@{Backward}!mlpack\+::ann\+::\+Softmax@{mlpack\+::ann\+::\+Softmax}}
\subsubsection{Backward()}
{\footnotesize\ttfamily void Backward (\begin{DoxyParamCaption}\item[{const arma\+::\+Mat$<$ eT $>$ \&}]{input,  }\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 through f. 

Using the results from the feed forward pass.


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



Get the delta. 



Definition at line 76 of file softmax.\+hpp.

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



Modify the delta. 



Definition at line 78 of file softmax.\+hpp.



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

\mbox{\label{classmlpack_1_1ann_1_1Softmax_a09440df0a90bdcc766e56e097d91205b}} 
\index{mlpack\+::ann\+::\+Softmax@{mlpack\+::ann\+::\+Softmax}!Forward@{Forward}}
\index{Forward@{Forward}!mlpack\+::ann\+::\+Softmax@{mlpack\+::ann\+::\+Softmax}}
\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_1Softmax_a8bae962cc603d1cab8d80ec78f8d505d}} 
\index{mlpack\+::ann\+::\+Softmax@{mlpack\+::ann\+::\+Softmax}!Output\+Parameter@{Output\+Parameter}}
\index{Output\+Parameter@{Output\+Parameter}!mlpack\+::ann\+::\+Softmax@{mlpack\+::ann\+::\+Softmax}}
\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 71 of file softmax.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1Softmax_a21d5f745f02c709625a4ee0907f004a5}} 
\index{mlpack\+::ann\+::\+Softmax@{mlpack\+::ann\+::\+Softmax}!Output\+Parameter@{Output\+Parameter}}
\index{Output\+Parameter@{Output\+Parameter}!mlpack\+::ann\+::\+Softmax@{mlpack\+::ann\+::\+Softmax}}
\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 73 of file softmax.\+hpp.

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



Serialize the layer. 



Referenced by Softmax$<$ 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-\/git/src/mlpack/methods/ann/layer/\textbf{ softmax.\+hpp}\end{DoxyCompactItemize}
