\hypertarget{classnntrainer_1_1Device}{}\doxysection{nntrainer\+::Device Class Reference}
\label{classnntrainer_1_1Device}\index{nntrainer::Device@{nntrainer::Device}}


\mbox{\hyperlink{classnntrainer_1_1Device}{Device}} to be used for the operations to run.  




{\ttfamily \#include $<$delegate.\+h$>$}

\doxysubsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
enum \mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09e}{Device\+Type}} \{ \mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09ead9747e2da342bdb995f6389533ad1a3d}{Device\+Type\+::cpu}}, 
\mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09ea0aa0be2a866411d9ff03515227454947}{Device\+Type\+::gpu}}, 
\mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09eaeff0dd6626ffa2e3059e0becac0f879e}{Device\+Type\+::npu}}
 \}
\begin{DoxyCompactList}\small\item\em \mbox{\hyperlink{classnntrainer_1_1Device}{Device}} type enumeration. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classnntrainer_1_1Device_aaa281f48026e7bc322420d3a068661e6}{Device}} (\mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09e}{Device\+Type}} device=\mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09ead9747e2da342bdb995f6389533ad1a3d}{Device\+Type\+::cpu}}, float mem\+\_\+frac=1.\+0, soft\+\_\+place=false, prec\+\_\+loss=false)
\begin{DoxyCompactList}\small\item\em Construct a new \mbox{\hyperlink{classnntrainer_1_1Device}{Device}} object. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1Device_ad6756654e2e5b2bfb2cb3bba963a7675}{set\+Device}} (\mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09e}{Device\+Type}} device)
\begin{DoxyCompactList}\small\item\em Set the \mbox{\hyperlink{classnntrainer_1_1Device}{Device}} object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09e}{Device\+Type}} \mbox{\hyperlink{classnntrainer_1_1Device_a60832152fb545d9fa9f5d7ab15e02426}{get\+Device}} ()
\begin{DoxyCompactList}\small\item\em Get the \mbox{\hyperlink{classnntrainer_1_1Device}{Device}} object. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1Device_a3e409fa733edf733ac603e175208ed4a}{set\+Memory\+Fraction}} (float memory\+\_\+fraction)
\begin{DoxyCompactList}\small\item\em Set the maximum memory fraction which can be used by the framework. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1Device_a565e3cb70d2a775d1dd16816d0b02924}{allow\+Soft\+Placement}} (bool soft\+\_\+placement)
\begin{DoxyCompactList}\small\item\em Allow placing the operations on device softly. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1Device_a8a3f4f09e41d40307e0d25d6eaa4817f}{allow\+Precision\+Loss}} (bool precision\+\_\+loss)
\begin{DoxyCompactList}\small\item\em Allow using low precision version of some of the operations. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
\mbox{\hyperlink{classnntrainer_1_1Device}{Device}} to be used for the operations to run. 

\begin{DoxyNote}{Note}
The selected delegate device will restrict the supported backend. 
\end{DoxyNote}


Definition at line 74 of file delegate.\+h.



\doxysubsection{Member Enumeration Documentation}
\mbox{\Hypertarget{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09e}\label{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09e}} 
\index{nntrainer::Device@{nntrainer::Device}!DeviceType@{DeviceType}}
\index{DeviceType@{DeviceType}!nntrainer::Device@{nntrainer::Device}}
\doxysubsubsection{\texorpdfstring{DeviceType}{DeviceType}}
{\footnotesize\ttfamily enum \mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09e}{nntrainer\+::\+Device\+::\+Device\+Type}}\hspace{0.3cm}{\ttfamily [strong]}}



\mbox{\hyperlink{classnntrainer_1_1Device}{Device}} type enumeration. 

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{cpu@{cpu}!nntrainer::Device@{nntrainer::Device}}\index{nntrainer::Device@{nntrainer::Device}!cpu@{cpu}}}\mbox{\Hypertarget{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09ead9747e2da342bdb995f6389533ad1a3d}\label{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09ead9747e2da342bdb995f6389533ad1a3d}} 
cpu&C\+PU as the device \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{gpu@{gpu}!nntrainer::Device@{nntrainer::Device}}\index{nntrainer::Device@{nntrainer::Device}!gpu@{gpu}}}\mbox{\Hypertarget{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09ea0aa0be2a866411d9ff03515227454947}\label{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09ea0aa0be2a866411d9ff03515227454947}} 
gpu&G\+PU as the device \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{npu@{npu}!nntrainer::Device@{nntrainer::Device}}\index{nntrainer::Device@{nntrainer::Device}!npu@{npu}}}\mbox{\Hypertarget{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09eaeff0dd6626ffa2e3059e0becac0f879e}\label{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09eaeff0dd6626ffa2e3059e0becac0f879e}} 
npu&N\+PU as the device \\
\hline

\end{DoxyEnumFields}


Definition at line 79 of file delegate.\+h.



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classnntrainer_1_1Device_aaa281f48026e7bc322420d3a068661e6}\label{classnntrainer_1_1Device_aaa281f48026e7bc322420d3a068661e6}} 
\index{nntrainer::Device@{nntrainer::Device}!Device@{Device}}
\index{Device@{Device}!nntrainer::Device@{nntrainer::Device}}
\doxysubsubsection{\texorpdfstring{Device()}{Device()}}
{\footnotesize\ttfamily nntrainer\+::\+Device\+::\+Device (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09e}{Device\+Type}}}]{device = {\ttfamily \mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09ead9747e2da342bdb995f6389533ad1a3d}{Device\+Type\+::cpu}}},  }\item[{float}]{mem\+\_\+frac = {\ttfamily 1.0},  }\item[{soft\+\_\+place}]{ = {\ttfamily false},  }\item[{prec\+\_\+loss}]{ = {\ttfamily false} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Construct a new \mbox{\hyperlink{classnntrainer_1_1Device}{Device}} object. 


\begin{DoxyParams}{Parameters}
{\em device} & \mbox{\hyperlink{classnntrainer_1_1Device}{Device}} delegate to be used for the operations to run. Default device is cpu. \\
\hline
{\em mem\+\_\+frac} & Maximum memory fraction to be used of the set device. \\
\hline
{\em soft\+\_\+place} & To enable soft device placement. \\
\hline
{\em prec\+\_\+loss} & To enable precision loss for faster computation for the device. \\
\hline
\end{DoxyParams}


Definition at line 95 of file delegate.\+h.



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classnntrainer_1_1Device_a8a3f4f09e41d40307e0d25d6eaa4817f}\label{classnntrainer_1_1Device_a8a3f4f09e41d40307e0d25d6eaa4817f}} 
\index{nntrainer::Device@{nntrainer::Device}!allowPrecisionLoss@{allowPrecisionLoss}}
\index{allowPrecisionLoss@{allowPrecisionLoss}!nntrainer::Device@{nntrainer::Device}}
\doxysubsubsection{\texorpdfstring{allowPrecisionLoss()}{allowPrecisionLoss()}}
{\footnotesize\ttfamily void nntrainer\+::\+Device\+::allow\+Precision\+Loss (\begin{DoxyParamCaption}\item[{bool}]{precision\+\_\+loss }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Allow using low precision version of some of the operations. 

This allows framework to use low precision operations (like float16 instead of float32) for some of the operations for higher performance with minimum impact to performance


\begin{DoxyParams}{Parameters}
{\em precision\+\_\+loss} & True to allow loss in precision, else false \\
\hline
\end{DoxyParams}


Definition at line 149 of file delegate.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Device_a565e3cb70d2a775d1dd16816d0b02924}\label{classnntrainer_1_1Device_a565e3cb70d2a775d1dd16816d0b02924}} 
\index{nntrainer::Device@{nntrainer::Device}!allowSoftPlacement@{allowSoftPlacement}}
\index{allowSoftPlacement@{allowSoftPlacement}!nntrainer::Device@{nntrainer::Device}}
\doxysubsubsection{\texorpdfstring{allowSoftPlacement()}{allowSoftPlacement()}}
{\footnotesize\ttfamily void nntrainer\+::\+Device\+::allow\+Soft\+Placement (\begin{DoxyParamCaption}\item[{bool}]{soft\+\_\+placement }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Allow placing the operations on device softly. 

This allows framework to use some other device other than the set device for some of the operations for optimization or if an operation is not supported for the selected device. This might incur extra memory copy overhead. \begin{DoxyNote}{Note}
When set to false, constructing the model can result in error if a required operation is not avaiable for that device.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em soft\+\_\+placement} & True to allow soft placement, else false \\
\hline
\end{DoxyParams}


Definition at line 136 of file delegate.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Device_a60832152fb545d9fa9f5d7ab15e02426}\label{classnntrainer_1_1Device_a60832152fb545d9fa9f5d7ab15e02426}} 
\index{nntrainer::Device@{nntrainer::Device}!getDevice@{getDevice}}
\index{getDevice@{getDevice}!nntrainer::Device@{nntrainer::Device}}
\doxysubsubsection{\texorpdfstring{getDevice()}{getDevice()}}
{\footnotesize\ttfamily \mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09e}{Device\+Type}} nntrainer\+::\+Device\+::get\+Device (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Get the \mbox{\hyperlink{classnntrainer_1_1Device}{Device}} object. 

\begin{DoxyReturn}{Returns}
Device\+Type The device type which is set 
\end{DoxyReturn}


Definition at line 114 of file delegate.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Device_ad6756654e2e5b2bfb2cb3bba963a7675}\label{classnntrainer_1_1Device_ad6756654e2e5b2bfb2cb3bba963a7675}} 
\index{nntrainer::Device@{nntrainer::Device}!setDevice@{setDevice}}
\index{setDevice@{setDevice}!nntrainer::Device@{nntrainer::Device}}
\doxysubsubsection{\texorpdfstring{setDevice()}{setDevice()}}
{\footnotesize\ttfamily void nntrainer\+::\+Device\+::set\+Device (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classnntrainer_1_1Device_a5dc219985fdab85c673f754a4b19a09e}{Device\+Type}}}]{device }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set the \mbox{\hyperlink{classnntrainer_1_1Device}{Device}} object. 


\begin{DoxyParams}{Parameters}
{\em device} & The device to be set to \\
\hline
\end{DoxyParams}


Definition at line 107 of file delegate.\+h.

\mbox{\Hypertarget{classnntrainer_1_1Device_a3e409fa733edf733ac603e175208ed4a}\label{classnntrainer_1_1Device_a3e409fa733edf733ac603e175208ed4a}} 
\index{nntrainer::Device@{nntrainer::Device}!setMemoryFraction@{setMemoryFraction}}
\index{setMemoryFraction@{setMemoryFraction}!nntrainer::Device@{nntrainer::Device}}
\doxysubsubsection{\texorpdfstring{setMemoryFraction()}{setMemoryFraction()}}
{\footnotesize\ttfamily void nntrainer\+::\+Device\+::set\+Memory\+Fraction (\begin{DoxyParamCaption}\item[{float}]{memory\+\_\+fraction }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set the maximum memory fraction which can be used by the framework. 


\begin{DoxyParams}{Parameters}
{\em memory\+\_\+fraction} & Maximum fraction of memory to be used \\
\hline
\end{DoxyParams}


Definition at line 121 of file delegate.\+h.



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{delegate_8h}{delegate.\+h}}\end{DoxyCompactItemize}
