\hypertarget{classnntrainer_1_1AppContext}{}\doxysection{nntrainer\+::App\+Context Class Reference}
\label{classnntrainer_1_1AppContext}\index{nntrainer::AppContext@{nntrainer::AppContext}}


App.  


\doxysubsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classnntrainer_1_1AppContext_aa404131c0b86e4da9f1a4a6275e295d1}\label{classnntrainer_1_1AppContext_aa404131c0b86e4da9f1a4a6275e295d1}} 
using {\bfseries Props\+Type} = std\+::vector$<$ std\+::string $>$
\item 
\mbox{\Hypertarget{classnntrainer_1_1AppContext_afdb09192929994f071bb49760548b2fc}\label{classnntrainer_1_1AppContext_afdb09192929994f071bb49760548b2fc}} 
{\footnotesize template$<$typename T $>$ }\\using {\bfseries Ptr\+Type} = std\+::unique\+\_\+ptr$<$ T $>$
\item 
\mbox{\Hypertarget{classnntrainer_1_1AppContext_ac0bd5eebe59c569447ebe40006259b5f}\label{classnntrainer_1_1AppContext_ac0bd5eebe59c569447ebe40006259b5f}} 
{\footnotesize template$<$typename T $>$ }\\using {\bfseries Factory\+Type} = std\+::function$<$ Ptr\+Type$<$ T $>$(const Props\+Type \&)$>$
\item 
\mbox{\Hypertarget{classnntrainer_1_1AppContext_a9245ab077a7df4d01d0c88c92bda9b16}\label{classnntrainer_1_1AppContext_a9245ab077a7df4d01d0c88c92bda9b16}} 
{\footnotesize template$<$typename T $>$ }\\using {\bfseries Ptr\+Factory\+Type} = Ptr\+Type$<$ T $>$($\ast$)(const Props\+Type \&)
\item 
\mbox{\Hypertarget{classnntrainer_1_1AppContext_a4834bba0c4070503cac8801720c4238f}\label{classnntrainer_1_1AppContext_a4834bba0c4070503cac8801720c4238f}} 
{\footnotesize template$<$typename T $>$ }\\using {\bfseries Str\+Index\+Type} = std\+::unordered\+\_\+map$<$ std\+::string, Factory\+Type$<$ T $>$ $>$
\item 
using \mbox{\hyperlink{classnntrainer_1_1AppContext_a4baebb6aec79068b400ff0d640e6c786}{Int\+Index\+Type}} = std\+::unordered\+\_\+map$<$ int, std\+::string $>$
\item 
{\footnotesize template$<$typename T $>$ }\\using \mbox{\hyperlink{classnntrainer_1_1AppContext_a66a0ce8987ea0bab4da2ee87798d3289}{Index\+Type}} = std\+::tuple$<$ Str\+Index\+Type$<$ T $>$, \mbox{\hyperlink{classnntrainer_1_1AppContext_a4baebb6aec79068b400ff0d640e6c786}{Int\+Index\+Type}} $>$
\item 
\mbox{\Hypertarget{classnntrainer_1_1AppContext_af444a068ea2448e68f29ec881fae4831}\label{classnntrainer_1_1AppContext_af444a068ea2448e68f29ec881fae4831}} 
{\footnotesize template$<$typename... Ts$>$ }\\using {\bfseries Factory\+Map} = std\+::tuple$<$ \mbox{\hyperlink{classnntrainer_1_1AppContext_a66a0ce8987ea0bab4da2ee87798d3289}{Index\+Type}}$<$ Ts $>$... $>$
\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classnntrainer_1_1AppContext_accdffd27a7b21a9e146f449c0855adb4}\label{classnntrainer_1_1AppContext_accdffd27a7b21a9e146f449c0855adb4}} 
\mbox{\hyperlink{classnntrainer_1_1AppContext_accdffd27a7b21a9e146f449c0855adb4}{App\+Context}} ()=default
\begin{DoxyCompactList}\small\item\em Default constructor. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1AppContext_a2411ba59400049fd00eb063009e978d8}{set\+Working\+Directory}} (const std\+::string \&base)
\begin{DoxyCompactList}\small\item\em Set Working Directory for a relative path. working directory is set canonically. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1AppContext_afd9311ad703bb0ca5daa6acd0fe7e4cc}{unset\+Working\+Directory}} ()
\begin{DoxyCompactList}\small\item\em unset working directory \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classnntrainer_1_1AppContext_a371af2bb741a06cc0b0c88fe9822425c}{has\+Working\+Directory}} ()
\begin{DoxyCompactList}\small\item\em query if the appcontext has working directory set \end{DoxyCompactList}\item 
int \mbox{\hyperlink{classnntrainer_1_1AppContext_afa231236e1ebf3e163d7befc630ee786}{register\+Layer}} (const std\+::string \&library\+\_\+path, const std\+::string \&base\+\_\+path=\char`\"{}\char`\"{})
\begin{DoxyCompactList}\small\item\em register a layer factory from a shared library plugin must have {\bfseries{extern \char`\"{}\+C\char`\"{} Layer\+Pluggable $\ast$ml\+\_\+train\+\_\+layer\+\_\+pluggable}} defined else error \end{DoxyCompactList}\item 
int \mbox{\hyperlink{classnntrainer_1_1AppContext_aec461fefcc23f6f1ede5f4b45ec575de}{register\+Optimizer}} (const std\+::string \&library\+\_\+path, const std\+::string \&base\+\_\+path=\char`\"{}\char`\"{})
\begin{DoxyCompactList}\small\item\em register a optimizer factory from a shared library plugin must have {\bfseries{extern \char`\"{}\+C\char`\"{} Optimizer\+Pluggable $\ast$ml\+\_\+train\+\_\+optimizer\+\_\+pluggable}} defined else error \end{DoxyCompactList}\item 
std\+::vector$<$ int $>$ \mbox{\hyperlink{classnntrainer_1_1AppContext_ab325bbfa6c56fd560b1dda2a496c9300}{register\+Pluggable\+From\+Directory}} (const std\+::string \&base\+\_\+path)
\begin{DoxyCompactList}\small\item\em register pluggables from a directory. \end{DoxyCompactList}\item 
const std\+::string \mbox{\hyperlink{classnntrainer_1_1AppContext_a9116c80469c58c1618153a1261e2644b}{get\+Working\+Path}} (const std\+::string \&path=\char`\"{}\char`\"{})
\begin{DoxyCompactList}\small\item\em Get Working Path from a relative or representation of a path starting from {\itshape working\+\_\+path\+\_\+base}. \end{DoxyCompactList}\item 
const std\+::vector$<$ std\+::string $>$ \mbox{\hyperlink{classnntrainer_1_1AppContext_a04e68fd85c56c6c926c44472a5561b3b}{get\+Properties}} (void)
\begin{DoxyCompactList}\small\item\em Get memory swap file path from configuration file. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename T $>$ }\\const int \mbox{\hyperlink{classnntrainer_1_1AppContext_a31d3828733f9e3086754b456dbc9f90e}{register\+Factory}} (const Ptr\+Factory\+Type$<$ T $>$ factory, const std\+::string \&key=\char`\"{}\char`\"{}, const int int\+\_\+key=-\/1)
\begin{DoxyCompactList}\small\item\em Factory register function, use this function to register custom object. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename T $>$ }\\const int \mbox{\hyperlink{classnntrainer_1_1AppContext_a9b978bb2d5dd68da45626b04ac7f47e2}{register\+Factory}} (const Factory\+Type$<$ T $>$ factory, const std\+::string \&key=\char`\"{}\char`\"{}, const int int\+\_\+key=-\/1)
\begin{DoxyCompactList}\small\item\em Factory register function, use this function to register custom object. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename T $>$ }\\Ptr\+Type$<$ T $>$ \mbox{\hyperlink{classnntrainer_1_1AppContext_a21b7d8d0c6b3eab7eac76bdba06bc4e9}{create\+Object}} (const int int\+\_\+key, const Props\+Type \&props=\{\}) const
\begin{DoxyCompactList}\small\item\em Create an Object from the integer key. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename T $>$ }\\Ptr\+Type$<$ T $>$ \mbox{\hyperlink{classnntrainer_1_1AppContext_a2379f28feb45ea0749d6f4bf1ff254f0}{create\+Object}} (const std\+::string \&key, const Props\+Type \&props=\{\}) const
\begin{DoxyCompactList}\small\item\em Create an Object from the string key. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \mbox{\hyperlink{classnntrainer_1_1AppContext}{App\+Context}} \& \mbox{\hyperlink{classnntrainer_1_1AppContext_a692d7f2657598782884be3b78957ccd3}{Global}} ()
\begin{DoxyCompactList}\small\item\em Get Global app context. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename T $>$ }\\static Ptr\+Type$<$ T $>$ \mbox{\hyperlink{classnntrainer_1_1AppContext_a71dab48709cdfaff7387a0d501ac76d1}{unknown\+Factory}} (const Props\+Type \&props)
\begin{DoxyCompactList}\small\item\em special factory that throws for unknown \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
App. 

configuration 

Definition at line 45 of file app\+\_\+context.\+h.



\doxysubsection{Member Typedef Documentation}
\mbox{\Hypertarget{classnntrainer_1_1AppContext_a66a0ce8987ea0bab4da2ee87798d3289}\label{classnntrainer_1_1AppContext_a66a0ce8987ea0bab4da2ee87798d3289}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!IndexType@{IndexType}}
\index{IndexType@{IndexType}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{IndexType}{IndexType}}
{\footnotesize\ttfamily template$<$typename T $>$ \\
using \mbox{\hyperlink{classnntrainer_1_1AppContext_a66a0ce8987ea0bab4da2ee87798d3289}{nntrainer\+::\+App\+Context\+::\+Index\+Type}} =  std\+::tuple$<$Str\+Index\+Type$<$T$>$, \mbox{\hyperlink{classnntrainer_1_1AppContext_a4baebb6aec79068b400ff0d640e6c786}{Int\+Index\+Type}}$>$}

This type contains tuple of 1) integer -\/$>$ string index 2) string -\/$>$ factory index 

Definition at line 68 of file app\+\_\+context.\+h.

\mbox{\Hypertarget{classnntrainer_1_1AppContext_a4baebb6aec79068b400ff0d640e6c786}\label{classnntrainer_1_1AppContext_a4baebb6aec79068b400ff0d640e6c786}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!IntIndexType@{IntIndexType}}
\index{IntIndexType@{IntIndexType}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{IntIndexType}{IntIndexType}}
{\footnotesize\ttfamily using \mbox{\hyperlink{classnntrainer_1_1AppContext_a4baebb6aec79068b400ff0d640e6c786}{nntrainer\+::\+App\+Context\+::\+Int\+Index\+Type}} =  std\+::unordered\+\_\+map$<$int, std\+::string$>$}

integer to string key 

Definition at line 60 of file app\+\_\+context.\+h.



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classnntrainer_1_1AppContext_a21b7d8d0c6b3eab7eac76bdba06bc4e9}\label{classnntrainer_1_1AppContext_a21b7d8d0c6b3eab7eac76bdba06bc4e9}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!createObject@{createObject}}
\index{createObject@{createObject}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{createObject()}{createObject()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily template$<$typename T $>$ \\
Ptr\+Type$<$T$>$ nntrainer\+::\+App\+Context\+::create\+Object (\begin{DoxyParamCaption}\item[{const int}]{int\+\_\+key,  }\item[{const Props\+Type \&}]{props = {\ttfamily \{\}} }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Create an Object from the integer key. 


\begin{DoxyTemplParams}{Template Parameters}
{\em T} & Type of Object, currently, Only optimizer is supported \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em int\+\_\+key} & integer key \\
\hline
{\em props} & property \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Ptr\+Type$<$\+T$>$ unique pointer to the object 
\end{DoxyReturn}


Definition at line 213 of file app\+\_\+context.\+h.

\mbox{\Hypertarget{classnntrainer_1_1AppContext_a2379f28feb45ea0749d6f4bf1ff254f0}\label{classnntrainer_1_1AppContext_a2379f28feb45ea0749d6f4bf1ff254f0}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!createObject@{createObject}}
\index{createObject@{createObject}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{createObject()}{createObject()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily template$<$typename T $>$ \\
Ptr\+Type$<$T$>$ nntrainer\+::\+App\+Context\+::create\+Object (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{key,  }\item[{const Props\+Type \&}]{props = {\ttfamily \{\}} }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Create an Object from the string key. 


\begin{DoxyTemplParams}{Template Parameters}
{\em T} & Type of object, currently, only optimizer is supported \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em key} & integer key \\
\hline
{\em props} & property \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Ptr\+Type$<$\+T$>$ unique pointer to the object 
\end{DoxyReturn}


Definition at line 240 of file app\+\_\+context.\+h.

\mbox{\Hypertarget{classnntrainer_1_1AppContext_a04e68fd85c56c6c926c44472a5561b3b}\label{classnntrainer_1_1AppContext_a04e68fd85c56c6c926c44472a5561b3b}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!getProperties@{getProperties}}
\index{getProperties@{getProperties}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{getProperties()}{getProperties()}}
{\footnotesize\ttfamily const std\+::vector$<$std\+::string$>$ nntrainer\+::\+App\+Context\+::get\+Properties (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Get memory swap file path from configuration file. 

\begin{DoxyReturn}{Returns}
memory swap path. If memory swap path is not presented in configuration file, it returns empty string 
\end{DoxyReturn}
\mbox{\Hypertarget{classnntrainer_1_1AppContext_a9116c80469c58c1618153a1261e2644b}\label{classnntrainer_1_1AppContext_a9116c80469c58c1618153a1261e2644b}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!getWorkingPath@{getWorkingPath}}
\index{getWorkingPath@{getWorkingPath}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{getWorkingPath()}{getWorkingPath()}}
{\footnotesize\ttfamily const std\+::string nntrainer\+::\+App\+Context\+::get\+Working\+Path (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{path = {\ttfamily \char`\"{}\char`\"{}} }\end{DoxyParamCaption})}



Get Working Path from a relative or representation of a path starting from {\itshape working\+\_\+path\+\_\+base}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em path} & to make full path \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
If absolute path is given, returns {\itshape path} If relative path is given and working\+\_\+path\+\_\+base is not set, return relative path. If relative path is given and working\+\_\+path\+\_\+base has set, return absolute path from current working directory 
\end{DoxyReturn}


Definition at line 409 of file app\+\_\+context.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1AppContext_a692d7f2657598782884be3b78957ccd3}\label{classnntrainer_1_1AppContext_a692d7f2657598782884be3b78957ccd3}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!Global@{Global}}
\index{Global@{Global}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{Global()}{Global()}}
{\footnotesize\ttfamily \mbox{\hyperlink{classnntrainer_1_1AppContext}{App\+Context}} \& nntrainer\+::\+App\+Context\+::\+Global (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Get Global app context. 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{classnntrainer_1_1AppContext}{App\+Context}}\& 
\end{DoxyReturn}
in g++ there is a bug that hangs up if caller throws, so registerer is noexcept although it\textquotesingle{}d better not \href{https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70298}{\texttt{ https\+://gcc.\+gnu.\+org/bugzilla/show\+\_\+bug.\+cgi?id=70298}}

Definition at line 377 of file app\+\_\+context.\+cpp.

Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1AppContext_a692d7f2657598782884be3b78957ccd3_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1AppContext_a371af2bb741a06cc0b0c88fe9822425c}\label{classnntrainer_1_1AppContext_a371af2bb741a06cc0b0c88fe9822425c}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!hasWorkingDirectory@{hasWorkingDirectory}}
\index{hasWorkingDirectory@{hasWorkingDirectory}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{hasWorkingDirectory()}{hasWorkingDirectory()}}
{\footnotesize\ttfamily bool nntrainer\+::\+App\+Context\+::has\+Working\+Directory (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



query if the appcontext has working directory set 


\begin{DoxyRetVals}{Return values}
{\em true} & working path base is set \\
\hline
{\em false} & working path base is not set \\
\hline
\end{DoxyRetVals}


Definition at line 105 of file app\+\_\+context.\+h.

\mbox{\Hypertarget{classnntrainer_1_1AppContext_a9b978bb2d5dd68da45626b04ac7f47e2}\label{classnntrainer_1_1AppContext_a9b978bb2d5dd68da45626b04ac7f47e2}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!registerFactory@{registerFactory}}
\index{registerFactory@{registerFactory}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{registerFactory()}{registerFactory()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily template$<$typename T $>$ \\
const int nntrainer\+::\+App\+Context\+::register\+Factory (\begin{DoxyParamCaption}\item[{const Factory\+Type$<$ T $>$}]{factory,  }\item[{const std\+::string \&}]{key = {\ttfamily \char`\"{}\char`\"{}},  }\item[{const int}]{int\+\_\+key = {\ttfamily -\/1} }\end{DoxyParamCaption})}



Factory register function, use this function to register custom object. 


\begin{DoxyTemplParams}{Template Parameters}
{\em T} & object to create. Currently Optimizer, \mbox{\hyperlink{classLayer}{Layer}} is supported \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em factory} & factory function that creates std\+::unique\+\_\+ptr$<$\+T$>$ \\
\hline
{\em key} & key to access the factory, if key is empty, try to find key by calling factory(\{\})-\/$>$get\+Type(); \\
\hline
{\em int\+\_\+key} & key to access the factory by integer, if it is -\/1(default), the function automatically unsigned the key and return \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
const int unique integer value to access the current factory 
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em invalid} & argument when key and/or int\+\_\+key is already taken \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{classnntrainer_1_1AppContext_a31d3828733f9e3086754b456dbc9f90e}\label{classnntrainer_1_1AppContext_a31d3828733f9e3086754b456dbc9f90e}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!registerFactory@{registerFactory}}
\index{registerFactory@{registerFactory}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{registerFactory()}{registerFactory()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily template$<$typename T $>$ \\
const int nntrainer\+::\+App\+Context\+::register\+Factory (\begin{DoxyParamCaption}\item[{const Ptr\+Factory\+Type$<$ T $>$}]{factory,  }\item[{const std\+::string \&}]{key = {\ttfamily \char`\"{}\char`\"{}},  }\item[{const int}]{int\+\_\+key = {\ttfamily -\/1} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Factory register function, use this function to register custom object. 


\begin{DoxyTemplParams}{Template Parameters}
{\em T} & object to create. Currently Optimizer, \mbox{\hyperlink{classLayer}{Layer}} is supported \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em factory} & factory function that creates std\+::unique\+\_\+ptr$<$\+T$>$ \\
\hline
{\em key} & key to access the factory, if key is empty, try to find key by calling factory(\{\})-\/$>$get\+Type(); \\
\hline
{\em int\+\_\+key} & key to access the factory by integer, if it is -\/1(default), the function automatically unsigned the key and return \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
const int unique integer value to access the current factory 
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em invalid} & argument when key and/or int\+\_\+key is already taken \\
\hline
\end{DoxyExceptions}


Definition at line 179 of file app\+\_\+context.\+h.

Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1AppContext_a31d3828733f9e3086754b456dbc9f90e_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1AppContext_afa231236e1ebf3e163d7befc630ee786}\label{classnntrainer_1_1AppContext_afa231236e1ebf3e163d7befc630ee786}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!registerLayer@{registerLayer}}
\index{registerLayer@{registerLayer}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{registerLayer()}{registerLayer()}}
{\footnotesize\ttfamily int nntrainer\+::\+App\+Context\+::register\+Layer (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{library\+\_\+path,  }\item[{const std\+::string \&}]{base\+\_\+path = {\ttfamily \char`\"{}\char`\"{}} }\end{DoxyParamCaption})}



register a layer factory from a shared library plugin must have {\bfseries{extern \char`\"{}\+C\char`\"{} Layer\+Pluggable $\ast$ml\+\_\+train\+\_\+layer\+\_\+pluggable}} defined else error 


\begin{DoxyParams}{Parameters}
{\em library\+\_\+path} & a file name of the library \\
\hline
{\em base\+\_\+path} & base path to make a full path (optional) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
int integer key to create the layer 
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em std\+::invalid\+\_\+parameter} & if library\+\_\+path is invalid or library is invalid \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{classnntrainer_1_1AppContext_aec461fefcc23f6f1ede5f4b45ec575de}\label{classnntrainer_1_1AppContext_aec461fefcc23f6f1ede5f4b45ec575de}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!registerOptimizer@{registerOptimizer}}
\index{registerOptimizer@{registerOptimizer}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{registerOptimizer()}{registerOptimizer()}}
{\footnotesize\ttfamily int nntrainer\+::\+App\+Context\+::register\+Optimizer (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{library\+\_\+path,  }\item[{const std\+::string \&}]{base\+\_\+path = {\ttfamily \char`\"{}\char`\"{}} }\end{DoxyParamCaption})}



register a optimizer factory from a shared library plugin must have {\bfseries{extern \char`\"{}\+C\char`\"{} Optimizer\+Pluggable $\ast$ml\+\_\+train\+\_\+optimizer\+\_\+pluggable}} defined else error 


\begin{DoxyParams}{Parameters}
{\em library\+\_\+path} & a file name of the library \\
\hline
{\em base\+\_\+path} & base path to make a full path (optional) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
int integer key to create the optimizer 
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em std\+::invalid\+\_\+parameter} & if library\+\_\+path is invalid or library is invalid \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{classnntrainer_1_1AppContext_ab325bbfa6c56fd560b1dda2a496c9300}\label{classnntrainer_1_1AppContext_ab325bbfa6c56fd560b1dda2a496c9300}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!registerPluggableFromDirectory@{registerPluggableFromDirectory}}
\index{registerPluggableFromDirectory@{registerPluggableFromDirectory}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{registerPluggableFromDirectory()}{registerPluggableFromDirectory()}}
{\footnotesize\ttfamily std\+::vector$<$int$>$ nntrainer\+::\+App\+Context\+::register\+Pluggable\+From\+Directory (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{base\+\_\+path }\end{DoxyParamCaption})}



register pluggables from a directory. 

\begin{DoxyNote}{Note}
if you have a clashing type with already registered pluggable, it will throw from {\ttfamily register\+Factory} function
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em base\+\_\+path} & a directory path to search pluggables\textquotesingle{}s \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
std\+::vector$<$int$>$ list of integer key to create a pluggable 
\end{DoxyReturn}
\mbox{\Hypertarget{classnntrainer_1_1AppContext_a2411ba59400049fd00eb063009e978d8}\label{classnntrainer_1_1AppContext_a2411ba59400049fd00eb063009e978d8}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!setWorkingDirectory@{setWorkingDirectory}}
\index{setWorkingDirectory@{setWorkingDirectory}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{setWorkingDirectory()}{setWorkingDirectory()}}
{\footnotesize\ttfamily void nntrainer\+::\+App\+Context\+::set\+Working\+Directory (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{base }\end{DoxyParamCaption})}



Set Working Directory for a relative path. working directory is set canonically. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em base} & base directory \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em std\+::invalid\+\_\+argument} & if path is not valid for current system \\
\hline
\end{DoxyExceptions}


Definition at line 386 of file app\+\_\+context.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1AppContext_a71dab48709cdfaff7387a0d501ac76d1}\label{classnntrainer_1_1AppContext_a71dab48709cdfaff7387a0d501ac76d1}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!unknownFactory@{unknownFactory}}
\index{unknownFactory@{unknownFactory}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{unknownFactory()}{unknownFactory()}}
{\footnotesize\ttfamily template$<$typename T $>$ \\
static Ptr\+Type$<$T$>$ nntrainer\+::\+App\+Context\+::unknown\+Factory (\begin{DoxyParamCaption}\item[{const Props\+Type \&}]{props }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



special factory that throws for unknown 


\begin{DoxyTemplParams}{Template Parameters}
{\em T} & object to create \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em props} & props to pass, not used \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em always} & throw runtime\+\_\+error \\
\hline
\end{DoxyExceptions}


Definition at line 270 of file app\+\_\+context.\+h.

\mbox{\Hypertarget{classnntrainer_1_1AppContext_afd9311ad703bb0ca5daa6acd0fe7e4cc}\label{classnntrainer_1_1AppContext_afd9311ad703bb0ca5daa6acd0fe7e4cc}} 
\index{nntrainer::AppContext@{nntrainer::AppContext}!unsetWorkingDirectory@{unsetWorkingDirectory}}
\index{unsetWorkingDirectory@{unsetWorkingDirectory}!nntrainer::AppContext@{nntrainer::AppContext}}
\doxysubsubsection{\texorpdfstring{unsetWorkingDirectory()}{unsetWorkingDirectory()}}
{\footnotesize\ttfamily void nntrainer\+::\+App\+Context\+::unset\+Working\+Directory (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



unset working directory 



Definition at line 97 of file app\+\_\+context.\+h.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{app__context_8h}{app\+\_\+context.\+h}}\item 
\mbox{\hyperlink{app__context_8cpp}{app\+\_\+context.\+cpp}}\end{DoxyCompactItemize}
