\hypertarget{classnntrainer_1_1Var__Grad}{}\doxysection{nntrainer\+::Var\+\_\+\+Grad Class Reference}
\label{classnntrainer_1_1Var__Grad}\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}


Variable with Gradient, and its corresponding need\+\_\+gradient property.  




{\ttfamily \#include $<$var\+\_\+grad.\+h$>$}



Inheritance diagram for nntrainer\+::Var\+\_\+\+Grad\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=191pt]{classnntrainer_1_1Var__Grad__inherit__graph}
\end{center}
\end{figure}
\doxysubsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
typedef \mbox{\hyperlink{namespacenntrainer_acb044356c97403667b8eaf26179baf9c}{Var\+Grad\+Spec}} \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a348805e717af6cb48db25f42a7aaf29f}{Spec}}
\begin{DoxyCompactList}\small\item\em Specification of the \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classnntrainer_1_1Var__Grad_ad41b9bd271a4355cb5bad47b76d805fb}{Var\+\_\+\+Grad}} ()
\begin{DoxyCompactList}\small\item\em \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} default constructor. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a3335dd0b9e697751bd9eacfe6813056b}\label{classnntrainer_1_1Var__Grad_a3335dd0b9e697751bd9eacfe6813056b}} 
virtual \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a3335dd0b9e697751bd9eacfe6813056b}{$\sim$\+Var\+\_\+\+Grad}} ()=default
\begin{DoxyCompactList}\small\item\em \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} default destructor. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1Var__Grad_ac2b6a637ee4b632417d2203cf2ad3f7b}{Var\+\_\+\+Grad}} (const Tensor\+Dim \&dim, const Tensor\+::\+Initializer init=Tensor\+::\+Initializer\+::\+N\+O\+NE, bool ng=true, bool alloc\+\_\+now=false, const std\+::string \&name=\char`\"{}\char`\"{})
\begin{DoxyCompactList}\small\item\em Construct a new \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1Var__Grad_a12c85ee09cd813fbc7d75953974aa920}{Var\+\_\+\+Grad}} (const \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a348805e717af6cb48db25f42a7aaf29f}{Spec}} \&spec, bool alloc\+\_\+now=false)
\begin{DoxyCompactList}\small\item\em Construct a new \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1Var__Grad_ab005dc47841418f4901bff9df293bb9a}{Var\+\_\+\+Grad}} (const Tensor \&v, const Tensor \&g, const std\+::string \&n=\char`\"{}\char`\"{}, bool \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a0e2d9b6e8da948cf26ec56e83d7e70a5}{is\+\_\+dependent}}=false)
\begin{DoxyCompactList}\small\item\em Construct a new \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1Var__Grad_a453110f969c4186d1b8c306115439b06}{Var\+\_\+\+Grad}} (Tensor $\ast$v, Tensor $\ast$g, bool \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a0e2d9b6e8da948cf26ec56e83d7e70a5}{is\+\_\+dependent}}=false)
\begin{DoxyCompactList}\small\item\em Construct a new \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1Var__Grad_ae7c6c7d8b5c888c44fab8cf102df15f0}{Var\+\_\+\+Grad}} (const \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \&rhs)=default
\begin{DoxyCompactList}\small\item\em Copy constructor for \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1Var__Grad_a6b3af581c1a0745d2ca9b5c07c6f0c17}{Var\+\_\+\+Grad}} (\mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \&\&rhs)=default
\begin{DoxyCompactList}\small\item\em Move constructor for \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \& \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a94452f3626d44656288f760e1bcc1f1a}{operator=}} (const \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \&rhs)=default
\begin{DoxyCompactList}\small\item\em copy assigment \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \& \mbox{\hyperlink{classnntrainer_1_1Var__Grad_aea8dd02be6ba8dc33ea62be94ae79cb8}{operator=}} (\mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \&\&rhs)=default
\begin{DoxyCompactList}\small\item\em move assignment \end{DoxyCompactList}\item 
virtual void \mbox{\hyperlink{classnntrainer_1_1Var__Grad_adf2eab51caa2a677f1336547dee0dae0}{initialize\+Variable}} (const Tensor \&preallocated=Tensor())
\begin{DoxyCompactList}\small\item\em Initialize the variable. \end{DoxyCompactList}\item 
virtual void \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a6302fe46435d3756869ce530cc6b2631}{initialize\+Gradient}} (const Tensor \&preallocated=Tensor())
\begin{DoxyCompactList}\small\item\em Initialize the gradient for the variable. \end{DoxyCompactList}\item 
Tensor\+Dim \mbox{\hyperlink{classnntrainer_1_1Var__Grad_ad19a4ae2569a073039ed99ad7b81432b}{get\+Dim}} () const
\begin{DoxyCompactList}\small\item\em Get the Tensor\+Dim. \end{DoxyCompactList}\item 
const std\+::string \& \mbox{\hyperlink{classnntrainer_1_1Var__Grad_ab5953e5a399a8d834d078a4c2dbef67a}{get\+Name}} () const
\begin{DoxyCompactList}\small\item\em Get the name of the variable. \end{DoxyCompactList}\item 
const std\+::string \& \mbox{\hyperlink{classnntrainer_1_1Var__Grad_ae9ba2970353a8f9282d40741928194d6}{get\+Gradient\+Name}} () const
\begin{DoxyCompactList}\small\item\em Get the name of the gradient. \end{DoxyCompactList}\item 
Tensor \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a353a01289faa5feeb7aa5bfa08729ead}{get\+Variable}} () const
\begin{DoxyCompactList}\small\item\em Get the variable tensor. \end{DoxyCompactList}\item 
Tensor \mbox{\hyperlink{classnntrainer_1_1Var__Grad_ae570bc4208bba4ce2d06fb3e84ffd841}{get\+Gradient}} () const
\begin{DoxyCompactList}\small\item\em Get the Gradient tensor. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1Var__Grad_af23cb3220803e12f845215fe32654d66}{reset\+Gradient}} ()
\begin{DoxyCompactList}\small\item\em Reset the gradient to 0. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1Var__Grad_aaebdf4c75a73bd0e0ff87a95ba4dd3a1}{set\+Batch\+Size}} (unsigned int batch)
\begin{DoxyCompactList}\small\item\em Set batch size. \end{DoxyCompactList}\item 
Tensor \& \mbox{\hyperlink{classnntrainer_1_1Var__Grad_aecf8ffc4f4ceb9677d222d2a92e00e1b}{get\+Variable\+Ref}} ()
\begin{DoxyCompactList}\small\item\em Get the variable tensor (by reference) \end{DoxyCompactList}\item 
Tensor \& \mbox{\hyperlink{classnntrainer_1_1Var__Grad_ab7de51e472ffffeb3935d3d11126df04}{get\+Gradient\+Ref}} ()
\begin{DoxyCompactList}\small\item\em Get the Gradient tensor (by reference) \end{DoxyCompactList}\item 
const Tensor \& \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a461b9c13bdb7552538a79eacf1fbd805}{get\+Variable\+Ref}} () const
\begin{DoxyCompactList}\small\item\em Get the variable tensor (by reference) \end{DoxyCompactList}\item 
const Tensor \& \mbox{\hyperlink{classnntrainer_1_1Var__Grad_aa0134b88e60a3ea2178894bd086faea2}{get\+Gradient\+Ref}} () const
\begin{DoxyCompactList}\small\item\em Get the Gradient tensor (by reference) \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a043527b5edcfc1edaa7cc4e8b1189e74}{has\+Gradient}} () const
\begin{DoxyCompactList}\small\item\em If this variable has gradient. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a18bf3d2beedda047633cf0cdd7e5c7de}{is\+Dependent}} () const
\begin{DoxyCompactList}\small\item\em check if given weight is dependent to other weight \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a99291e2de098bd558281174880412c34}{set\+As\+Gradient\+First\+Access}} ()
\begin{DoxyCompactList}\small\item\em Set the As First Gradient Access. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a38f6363a6f520b19bec4caf5df14b25a}{set\+As\+Gradient\+Last\+Access}} ()
\begin{DoxyCompactList}\small\item\em Set the As Gradient Last Access object. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a25a7eece82eb8e86cd36925ffb4f378d}{is\+Gradient\+First\+Access}} () const
\begin{DoxyCompactList}\small\item\em check if given weight at the last execution order (first access of gradient) \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classnntrainer_1_1Var__Grad_adcfee52fc48e200a4d22d30c57af8f9c}{is\+Gradient\+Last\+Access}} () const
\begin{DoxyCompactList}\small\item\em check if given weight at the first execution order (last access of gradient) \end{DoxyCompactList}\item 
float \mbox{\hyperlink{classnntrainer_1_1Var__Grad_af9847c4e481d392c610eb3c1def0fea3}{get\+Gradient\+Norm}} () const
\begin{DoxyCompactList}\small\item\em Get the norm of the gradient. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Static Public Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_adbc76a28023791e4b7dfa84198971317}\label{classnntrainer_1_1Var__Grad_adbc76a28023791e4b7dfa84198971317}} 
static const std\+::string {\bfseries grad\+\_\+suffix} = \char`\"{}\+:grad\char`\"{}
\end{DoxyCompactItemize}
\doxysubsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
bool \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a0e2d9b6e8da948cf26ec56e83d7e70a5}{is\+\_\+dependent}}
\item 
bool \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a89b47dc1fa646ef4d36494a6dedae11f}{is\+\_\+first\+\_\+access\+\_\+gradient}}
\item 
bool \mbox{\hyperlink{classnntrainer_1_1Var__Grad_ab150a350a221076f63d370fdb3377bce}{is\+\_\+last\+\_\+access\+\_\+gradient}}
\item 
std\+::shared\+\_\+ptr$<$ Tensor $>$ \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a537cf3964fd01c6788c572b0fb93a017}{var}}
\item 
std\+::shared\+\_\+ptr$<$ Tensor $>$ \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a81ad146f9dc704ab1bbcea944c640462}{grad}}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Variable with Gradient, and its corresponding need\+\_\+gradient property. 

Definition at line 28 of file var\+\_\+grad.\+h.



\doxysubsection{Member Typedef Documentation}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a348805e717af6cb48db25f42a7aaf29f}\label{classnntrainer_1_1Var__Grad_a348805e717af6cb48db25f42a7aaf29f}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!Spec@{Spec}}
\index{Spec@{Spec}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{Spec}{Spec}}
{\footnotesize\ttfamily typedef \mbox{\hyperlink{namespacenntrainer_acb044356c97403667b8eaf26179baf9c}{Var\+Grad\+Spec}} \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a348805e717af6cb48db25f42a7aaf29f}{nntrainer\+::\+Var\+\_\+\+Grad\+::\+Spec}}}



Specification of the \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}}. 

The tuple values are dimension, need\+\_\+gradient property, and the name of the \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} object. 

Definition at line 36 of file var\+\_\+grad.\+h.



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_ad41b9bd271a4355cb5bad47b76d805fb}\label{classnntrainer_1_1Var__Grad_ad41b9bd271a4355cb5bad47b76d805fb}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!Var\_Grad@{Var\_Grad}}
\index{Var\_Grad@{Var\_Grad}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{Var\_Grad()}{Var\_Grad()}\hspace{0.1cm}{\footnotesize\ttfamily [1/7]}}
{\footnotesize\ttfamily nntrainer\+::\+Var\+\_\+\+Grad\+::\+Var\+\_\+\+Grad (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



\mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} default constructor. 

\begin{DoxyNote}{Note}
Default variable is not need\+\_\+gradient as gradient is 0 dim tensor 
\end{DoxyNote}


Definition at line 42 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_ac2b6a637ee4b632417d2203cf2ad3f7b}\label{classnntrainer_1_1Var__Grad_ac2b6a637ee4b632417d2203cf2ad3f7b}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!Var\_Grad@{Var\_Grad}}
\index{Var\_Grad@{Var\_Grad}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{Var\_Grad()}{Var\_Grad()}\hspace{0.1cm}{\footnotesize\ttfamily [2/7]}}
{\footnotesize\ttfamily nntrainer\+::\+Var\+\_\+\+Grad\+::\+Var\+\_\+\+Grad (\begin{DoxyParamCaption}\item[{const Tensor\+Dim \&}]{dim,  }\item[{const Tensor\+::\+Initializer}]{init = {\ttfamily Tensor\+:\+:Initializer\+:\+:NONE},  }\item[{bool}]{ng = {\ttfamily true},  }\item[{bool}]{alloc\+\_\+now = {\ttfamily false},  }\item[{const std\+::string \&}]{name = {\ttfamily \char`\"{}\char`\"{}} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [explicit]}}



Construct a new \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} object. 


\begin{DoxyParams}{Parameters}
{\em dim} & Variable and gradient tensor dimension \\
\hline
{\em ng} & If the variable is need\+\_\+gradient \\
\hline
{\em alloc\+\_\+now} & The memory for the var\+\_\+grad tensors be allocated upon init \\
\hline
{\em name} & Name for this \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \\
\hline
\end{DoxyParams}
\begin{DoxyRefDesc}{Todo}
\item[\mbox{\hyperlink{todo__todo000140}{Todo}}]gradient initializer should be none, and then they should be set zero right before using by the user itself. \end{DoxyRefDesc}


Definition at line 21 of file var\+\_\+grad.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a12c85ee09cd813fbc7d75953974aa920}\label{classnntrainer_1_1Var__Grad_a12c85ee09cd813fbc7d75953974aa920}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!Var\_Grad@{Var\_Grad}}
\index{Var\_Grad@{Var\_Grad}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{Var\_Grad()}{Var\_Grad()}\hspace{0.1cm}{\footnotesize\ttfamily [3/7]}}
{\footnotesize\ttfamily nntrainer\+::\+Var\+\_\+\+Grad\+::\+Var\+\_\+\+Grad (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classnntrainer_1_1Var__Grad_a348805e717af6cb48db25f42a7aaf29f}{Spec}} \&}]{spec,  }\item[{bool}]{alloc\+\_\+now = {\ttfamily false} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [explicit]}}



Construct a new \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} object. 


\begin{DoxyParams}{Parameters}
{\em spec} & \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} specification \\
\hline
\end{DoxyParams}


Definition at line 67 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_ab005dc47841418f4901bff9df293bb9a}\label{classnntrainer_1_1Var__Grad_ab005dc47841418f4901bff9df293bb9a}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!Var\_Grad@{Var\_Grad}}
\index{Var\_Grad@{Var\_Grad}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{Var\_Grad()}{Var\_Grad()}\hspace{0.1cm}{\footnotesize\ttfamily [4/7]}}
{\footnotesize\ttfamily nntrainer\+::\+Var\+\_\+\+Grad\+::\+Var\+\_\+\+Grad (\begin{DoxyParamCaption}\item[{const Tensor \&}]{v,  }\item[{const Tensor \&}]{g,  }\item[{const std\+::string \&}]{n = {\ttfamily \char`\"{}\char`\"{}},  }\item[{bool}]{is\+\_\+dependent = {\ttfamily false} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [explicit]}}



Construct a new \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} object. 


\begin{DoxyParams}{Parameters}
{\em v} & Already created variable object \\
\hline
{\em g} & Already created gradient object \\
\hline
{\em n} & Name for this \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \\
\hline
{\em is\+\_\+dependent} & true if the var grad is dependent\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
This A\+PI is not recommended for usage and must be used for internal uses only, as \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} does not own the tensors v and g, and can go invalid if the owner of these tensors free the tensors. 
\end{DoxyNote}


Definition at line 87 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a453110f969c4186d1b8c306115439b06}\label{classnntrainer_1_1Var__Grad_a453110f969c4186d1b8c306115439b06}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!Var\_Grad@{Var\_Grad}}
\index{Var\_Grad@{Var\_Grad}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{Var\_Grad()}{Var\_Grad()}\hspace{0.1cm}{\footnotesize\ttfamily [5/7]}}
{\footnotesize\ttfamily nntrainer\+::\+Var\+\_\+\+Grad\+::\+Var\+\_\+\+Grad (\begin{DoxyParamCaption}\item[{Tensor $\ast$}]{v,  }\item[{Tensor $\ast$}]{g,  }\item[{bool}]{is\+\_\+dependent = {\ttfamily false} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [explicit]}}



Construct a new \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} object. 


\begin{DoxyParams}{Parameters}
{\em v} & ptr to already created variable tensor \\
\hline
{\em g} & ptr to already created gradient tensor \\
\hline
{\em is\+\_\+dependent} & true if the given var grad is dependent \\
\hline
\end{DoxyParams}


Definition at line 107 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_ae7c6c7d8b5c888c44fab8cf102df15f0}\label{classnntrainer_1_1Var__Grad_ae7c6c7d8b5c888c44fab8cf102df15f0}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!Var\_Grad@{Var\_Grad}}
\index{Var\_Grad@{Var\_Grad}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{Var\_Grad()}{Var\_Grad()}\hspace{0.1cm}{\footnotesize\ttfamily [6/7]}}
{\footnotesize\ttfamily nntrainer\+::\+Var\+\_\+\+Grad\+::\+Var\+\_\+\+Grad (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \&}]{rhs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [default]}}



Copy constructor for \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}}. 


\begin{DoxyParams}{Parameters}
{\em rhs} & \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} to construct from \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a6b3af581c1a0745d2ca9b5c07c6f0c17}\label{classnntrainer_1_1Var__Grad_a6b3af581c1a0745d2ca9b5c07c6f0c17}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!Var\_Grad@{Var\_Grad}}
\index{Var\_Grad@{Var\_Grad}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{Var\_Grad()}{Var\_Grad()}\hspace{0.1cm}{\footnotesize\ttfamily [7/7]}}
{\footnotesize\ttfamily nntrainer\+::\+Var\+\_\+\+Grad\+::\+Var\+\_\+\+Grad (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \&\&}]{rhs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [default]}}



Move constructor for \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}}. 


\begin{DoxyParams}{Parameters}
{\em rhs} & \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} to construct from \\
\hline
\end{DoxyParams}


\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_ad19a4ae2569a073039ed99ad7b81432b}\label{classnntrainer_1_1Var__Grad_ad19a4ae2569a073039ed99ad7b81432b}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!getDim@{getDim}}
\index{getDim@{getDim}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{getDim()}{getDim()}}
{\footnotesize\ttfamily Tensor\+Dim nntrainer\+::\+Var\+\_\+\+Grad\+::get\+Dim (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the Tensor\+Dim. 

\begin{DoxyReturn}{Returns}
Tensor\+Dim Dimension 
\end{DoxyReturn}


Definition at line 166 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_ae570bc4208bba4ce2d06fb3e84ffd841}\label{classnntrainer_1_1Var__Grad_ae570bc4208bba4ce2d06fb3e84ffd841}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!getGradient@{getGradient}}
\index{getGradient@{getGradient}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{getGradient()}{getGradient()}}
{\footnotesize\ttfamily Tensor nntrainer\+::\+Var\+\_\+\+Grad\+::get\+Gradient (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the Gradient tensor. 

\begin{DoxyReturn}{Returns}
Tensor Gradient tensor 
\end{DoxyReturn}


Definition at line 194 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_ae9ba2970353a8f9282d40741928194d6}\label{classnntrainer_1_1Var__Grad_ae9ba2970353a8f9282d40741928194d6}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!getGradientName@{getGradientName}}
\index{getGradientName@{getGradientName}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{getGradientName()}{getGradientName()}}
{\footnotesize\ttfamily const std\+::string\& nntrainer\+::\+Var\+\_\+\+Grad\+::get\+Gradient\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the name of the gradient. 

\begin{DoxyReturn}{Returns}
std\+::string name of the gradient 
\end{DoxyReturn}


Definition at line 180 of file var\+\_\+grad.\+h.

Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1Var__Grad_ae9ba2970353a8f9282d40741928194d6_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_af9847c4e481d392c610eb3c1def0fea3}\label{classnntrainer_1_1Var__Grad_af9847c4e481d392c610eb3c1def0fea3}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!getGradientNorm@{getGradientNorm}}
\index{getGradientNorm@{getGradientNorm}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{getGradientNorm()}{getGradientNorm()}}
{\footnotesize\ttfamily float nntrainer\+::\+Var\+\_\+\+Grad\+::get\+Gradient\+Norm (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the norm of the gradient. 

\begin{DoxyReturn}{Returns}
float l2 norm of the gradient 
\end{DoxyReturn}


Definition at line 299 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_ab7de51e472ffffeb3935d3d11126df04}\label{classnntrainer_1_1Var__Grad_ab7de51e472ffffeb3935d3d11126df04}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!getGradientRef@{getGradientRef}}
\index{getGradientRef@{getGradientRef}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{getGradientRef()}{getGradientRef()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Tensor\& nntrainer\+::\+Var\+\_\+\+Grad\+::get\+Gradient\+Ref (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Get the Gradient tensor (by reference) 

\begin{DoxyReturn}{Returns}
Tensor Gradient tensor 
\end{DoxyReturn}


Definition at line 228 of file var\+\_\+grad.\+h.

Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1Var__Grad_ab7de51e472ffffeb3935d3d11126df04_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_aa0134b88e60a3ea2178894bd086faea2}\label{classnntrainer_1_1Var__Grad_aa0134b88e60a3ea2178894bd086faea2}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!getGradientRef@{getGradientRef}}
\index{getGradientRef@{getGradientRef}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{getGradientRef()}{getGradientRef()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily const Tensor\& nntrainer\+::\+Var\+\_\+\+Grad\+::get\+Gradient\+Ref (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the Gradient tensor (by reference) 

\begin{DoxyReturn}{Returns}
Tensor Gradient tensor 
\end{DoxyReturn}


Definition at line 242 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_ab5953e5a399a8d834d078a4c2dbef67a}\label{classnntrainer_1_1Var__Grad_ab5953e5a399a8d834d078a4c2dbef67a}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!getName@{getName}}
\index{getName@{getName}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{getName()}{getName()}}
{\footnotesize\ttfamily const std\+::string\& nntrainer\+::\+Var\+\_\+\+Grad\+::get\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the name of the variable. 

\begin{DoxyReturn}{Returns}
std\+::string name of the variable 
\end{DoxyReturn}


Definition at line 173 of file var\+\_\+grad.\+h.

Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1Var__Grad_ab5953e5a399a8d834d078a4c2dbef67a_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a353a01289faa5feeb7aa5bfa08729ead}\label{classnntrainer_1_1Var__Grad_a353a01289faa5feeb7aa5bfa08729ead}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!getVariable@{getVariable}}
\index{getVariable@{getVariable}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{getVariable()}{getVariable()}}
{\footnotesize\ttfamily Tensor nntrainer\+::\+Var\+\_\+\+Grad\+::get\+Variable (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the variable tensor. 

\begin{DoxyReturn}{Returns}
Tensor Variable tensor 
\end{DoxyReturn}


Definition at line 187 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_aecf8ffc4f4ceb9677d222d2a92e00e1b}\label{classnntrainer_1_1Var__Grad_aecf8ffc4f4ceb9677d222d2a92e00e1b}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!getVariableRef@{getVariableRef}}
\index{getVariableRef@{getVariableRef}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{getVariableRef()}{getVariableRef()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Tensor\& nntrainer\+::\+Var\+\_\+\+Grad\+::get\+Variable\+Ref (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Get the variable tensor (by reference) 

\begin{DoxyReturn}{Returns}
Tensor Variable tensor 
\end{DoxyReturn}


Definition at line 221 of file var\+\_\+grad.\+h.

Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1Var__Grad_aecf8ffc4f4ceb9677d222d2a92e00e1b_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a461b9c13bdb7552538a79eacf1fbd805}\label{classnntrainer_1_1Var__Grad_a461b9c13bdb7552538a79eacf1fbd805}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!getVariableRef@{getVariableRef}}
\index{getVariableRef@{getVariableRef}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{getVariableRef()}{getVariableRef()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily const Tensor\& nntrainer\+::\+Var\+\_\+\+Grad\+::get\+Variable\+Ref (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the variable tensor (by reference) 

\begin{DoxyReturn}{Returns}
Tensor Variable tensor 
\end{DoxyReturn}


Definition at line 235 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a043527b5edcfc1edaa7cc4e8b1189e74}\label{classnntrainer_1_1Var__Grad_a043527b5edcfc1edaa7cc4e8b1189e74}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!hasGradient@{hasGradient}}
\index{hasGradient@{hasGradient}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{hasGradient()}{hasGradient()}}
{\footnotesize\ttfamily bool nntrainer\+::\+Var\+\_\+\+Grad\+::has\+Gradient (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



If this variable has gradient. 

\begin{DoxyReturn}{Returns}
true if the var\+\_\+grad as gradient set, else false 
\end{DoxyReturn}
\begin{DoxyNote}{Note}
this is can return is the var\+\_\+grad needs gradient but it not empty 
\end{DoxyNote}


Definition at line 251 of file var\+\_\+grad.\+h.

Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1Var__Grad_a043527b5edcfc1edaa7cc4e8b1189e74_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a6302fe46435d3756869ce530cc6b2631}\label{classnntrainer_1_1Var__Grad_a6302fe46435d3756869ce530cc6b2631}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!initializeGradient@{initializeGradient}}
\index{initializeGradient@{initializeGradient}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{initializeGradient()}{initializeGradient()}}
{\footnotesize\ttfamily void nntrainer\+::\+Var\+\_\+\+Grad\+::initialize\+Gradient (\begin{DoxyParamCaption}\item[{const Tensor \&}]{preallocated = {\ttfamily Tensor()} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Initialize the gradient for the variable. 


\begin{DoxyParams}{Parameters}
{\em preallocated} & if initialized, use this tensor for gradient memory \\
\hline
\end{DoxyParams}
Making a new tensor is intentional here as this tensor is not shared with other layers but the internal memory is.

intentionally not initialized tensor memory for shared tensors

Definition at line 50 of file var\+\_\+grad.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_adf2eab51caa2a677f1336547dee0dae0}\label{classnntrainer_1_1Var__Grad_adf2eab51caa2a677f1336547dee0dae0}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!initializeVariable@{initializeVariable}}
\index{initializeVariable@{initializeVariable}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{initializeVariable()}{initializeVariable()}}
{\footnotesize\ttfamily void nntrainer\+::\+Var\+\_\+\+Grad\+::initialize\+Variable (\begin{DoxyParamCaption}\item[{const Tensor \&}]{preallocated = {\ttfamily Tensor()} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Initialize the variable. 


\begin{DoxyParams}{Parameters}
{\em preallocated} & if initialized, use this tensor for variable memory \\
\hline
\end{DoxyParams}
Making a new tensor is intentional here as this tensor is not shared with other layers but the internal memory is.

intentionally not initialized tensor memory for shared tensors

Definition at line 41 of file var\+\_\+grad.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a18bf3d2beedda047633cf0cdd7e5c7de}\label{classnntrainer_1_1Var__Grad_a18bf3d2beedda047633cf0cdd7e5c7de}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!isDependent@{isDependent}}
\index{isDependent@{isDependent}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{isDependent()}{isDependent()}}
{\footnotesize\ttfamily bool nntrainer\+::\+Var\+\_\+\+Grad\+::is\+Dependent (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



check if given weight is dependent to other weight 

\begin{DoxyReturn}{Returns}
bool return true if the weight is dependent to others 
\end{DoxyReturn}


Definition at line 264 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a25a7eece82eb8e86cd36925ffb4f378d}\label{classnntrainer_1_1Var__Grad_a25a7eece82eb8e86cd36925ffb4f378d}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!isGradientFirstAccess@{isGradientFirstAccess}}
\index{isGradientFirstAccess@{isGradientFirstAccess}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{isGradientFirstAccess()}{isGradientFirstAccess()}}
{\footnotesize\ttfamily bool nntrainer\+::\+Var\+\_\+\+Grad\+::is\+Gradient\+First\+Access (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



check if given weight at the last execution order (first access of gradient) 

\begin{DoxyReturn}{Returns}
bool true if last access 
\end{DoxyReturn}


Definition at line 284 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_adcfee52fc48e200a4d22d30c57af8f9c}\label{classnntrainer_1_1Var__Grad_adcfee52fc48e200a4d22d30c57af8f9c}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!isGradientLastAccess@{isGradientLastAccess}}
\index{isGradientLastAccess@{isGradientLastAccess}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{isGradientLastAccess()}{isGradientLastAccess()}}
{\footnotesize\ttfamily bool nntrainer\+::\+Var\+\_\+\+Grad\+::is\+Gradient\+Last\+Access (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



check if given weight at the first execution order (last access of gradient) 

\begin{DoxyReturn}{Returns}
bool true if last access 
\end{DoxyReturn}


Definition at line 292 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a94452f3626d44656288f760e1bcc1f1a}\label{classnntrainer_1_1Var__Grad_a94452f3626d44656288f760e1bcc1f1a}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!operator=@{operator=}}
\index{operator=@{operator=}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{operator=()}{operator=()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}}\& nntrainer\+::\+Var\+\_\+\+Grad\+::operator= (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \&}]{rhs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [default]}}



copy assigment 


\begin{DoxyParams}{Parameters}
{\em rhs} & copy from \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}}\& Updated \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} 
\end{DoxyReturn}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_aea8dd02be6ba8dc33ea62be94ae79cb8}\label{classnntrainer_1_1Var__Grad_aea8dd02be6ba8dc33ea62be94ae79cb8}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!operator=@{operator=}}
\index{operator=@{operator=}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{operator=()}{operator=()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}}\& nntrainer\+::\+Var\+\_\+\+Grad\+::operator= (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} \&\&}]{rhs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [default]}}



move assignment 


\begin{DoxyParams}{Parameters}
{\em rhs} & move from \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}}\& Updated \mbox{\hyperlink{classnntrainer_1_1Var__Grad}{Var\+\_\+\+Grad}} 
\end{DoxyReturn}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_af23cb3220803e12f845215fe32654d66}\label{classnntrainer_1_1Var__Grad_af23cb3220803e12f845215fe32654d66}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!resetGradient@{resetGradient}}
\index{resetGradient@{resetGradient}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{resetGradient()}{resetGradient()}}
{\footnotesize\ttfamily void nntrainer\+::\+Var\+\_\+\+Grad\+::reset\+Gradient (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Reset the gradient to 0. 

zero the gradient

Definition at line 199 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a99291e2de098bd558281174880412c34}\label{classnntrainer_1_1Var__Grad_a99291e2de098bd558281174880412c34}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!setAsGradientFirstAccess@{setAsGradientFirstAccess}}
\index{setAsGradientFirstAccess@{setAsGradientFirstAccess}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{setAsGradientFirstAccess()}{setAsGradientFirstAccess()}}
{\footnotesize\ttfamily void nntrainer\+::\+Var\+\_\+\+Grad\+::set\+As\+Gradient\+First\+Access (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set the As First Gradient Access. 



Definition at line 270 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a38f6363a6f520b19bec4caf5df14b25a}\label{classnntrainer_1_1Var__Grad_a38f6363a6f520b19bec4caf5df14b25a}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!setAsGradientLastAccess@{setAsGradientLastAccess}}
\index{setAsGradientLastAccess@{setAsGradientLastAccess}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{setAsGradientLastAccess()}{setAsGradientLastAccess()}}
{\footnotesize\ttfamily void nntrainer\+::\+Var\+\_\+\+Grad\+::set\+As\+Gradient\+Last\+Access (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set the As Gradient Last Access object. 



Definition at line 276 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_aaebdf4c75a73bd0e0ff87a95ba4dd3a1}\label{classnntrainer_1_1Var__Grad_aaebdf4c75a73bd0e0ff87a95ba4dd3a1}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!setBatchSize@{setBatchSize}}
\index{setBatchSize@{setBatchSize}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{setBatchSize()}{setBatchSize()}}
{\footnotesize\ttfamily void nntrainer\+::\+Var\+\_\+\+Grad\+::set\+Batch\+Size (\begin{DoxyParamCaption}\item[{unsigned int}]{batch }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set batch size. 


\begin{DoxyParams}{Parameters}
{\em batch} & batch size \\
\hline
\end{DoxyParams}


Definition at line 209 of file var\+\_\+grad.\+h.



\doxysubsection{Member Data Documentation}
\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a81ad146f9dc704ab1bbcea944c640462}\label{classnntrainer_1_1Var__Grad_a81ad146f9dc704ab1bbcea944c640462}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!grad@{grad}}
\index{grad@{grad}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{grad}{grad}}
{\footnotesize\ttfamily std\+::shared\+\_\+ptr$<$Tensor$>$ nntrainer\+::\+Var\+\_\+\+Grad\+::grad\hspace{0.3cm}{\ttfamily [protected]}}

gradient for the variable 

Definition at line 312 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a0e2d9b6e8da948cf26ec56e83d7e70a5}\label{classnntrainer_1_1Var__Grad_a0e2d9b6e8da948cf26ec56e83d7e70a5}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!is\_dependent@{is\_dependent}}
\index{is\_dependent@{is\_dependent}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{is\_dependent}{is\_dependent}}
{\footnotesize\ttfamily bool nntrainer\+::\+Var\+\_\+\+Grad\+::is\+\_\+dependent\hspace{0.3cm}{\ttfamily [protected]}}

check if the weight tensor is burrowed from somewhere thus it is dependent 

Definition at line 304 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a89b47dc1fa646ef4d36494a6dedae11f}\label{classnntrainer_1_1Var__Grad_a89b47dc1fa646ef4d36494a6dedae11f}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!is\_first\_access\_gradient@{is\_first\_access\_gradient}}
\index{is\_first\_access\_gradient@{is\_first\_access\_gradient}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{is\_first\_access\_gradient}{is\_first\_access\_gradient}}
{\footnotesize\ttfamily bool nntrainer\+::\+Var\+\_\+\+Grad\+::is\+\_\+first\+\_\+access\+\_\+gradient\hspace{0.3cm}{\ttfamily [protected]}}

check if current weight tensor is first access 

Definition at line 306 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_ab150a350a221076f63d370fdb3377bce}\label{classnntrainer_1_1Var__Grad_ab150a350a221076f63d370fdb3377bce}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!is\_last\_access\_gradient@{is\_last\_access\_gradient}}
\index{is\_last\_access\_gradient@{is\_last\_access\_gradient}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{is\_last\_access\_gradient}{is\_last\_access\_gradient}}
{\footnotesize\ttfamily bool nntrainer\+::\+Var\+\_\+\+Grad\+::is\+\_\+last\+\_\+access\+\_\+gradient\hspace{0.3cm}{\ttfamily [protected]}}

check if current weight tensor is last access 

Definition at line 308 of file var\+\_\+grad.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Var__Grad_a537cf3964fd01c6788c572b0fb93a017}\label{classnntrainer_1_1Var__Grad_a537cf3964fd01c6788c572b0fb93a017}} 
\index{nntrainer::Var\_Grad@{nntrainer::Var\_Grad}!var@{var}}
\index{var@{var}!nntrainer::Var\_Grad@{nntrainer::Var\_Grad}}
\doxysubsubsection{\texorpdfstring{var}{var}}
{\footnotesize\ttfamily std\+::shared\+\_\+ptr$<$Tensor$>$ nntrainer\+::\+Var\+\_\+\+Grad\+::var\hspace{0.3cm}{\ttfamily [protected]}}

variable to be updated and used 

Definition at line 311 of file var\+\_\+grad.\+h.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
tensor/\mbox{\hyperlink{var__grad_8h}{var\+\_\+grad.\+h}}\item 
tensor/\mbox{\hyperlink{var__grad_8cpp}{var\+\_\+grad.\+cpp}}\end{DoxyCompactItemize}
