\hypertarget{tensor__if_8h}{}\doxysection{nnstreamer/include/tensor\+\_\+if.h File Reference}
\label{tensor__if_8h}\index{nnstreamer/include/tensor\_if.h@{nnstreamer/include/tensor\_if.h}}


N\+N\+Streamer A\+P\+Is for tensor\+\_\+if custom condition.  


{\ttfamily \#include $<$glib.\+h$>$}\newline
{\ttfamily \#include $<$gst/gst.\+h$>$}\newline
{\ttfamily \#include \char`\"{}tensor\+\_\+typedef.\+h\char`\"{}}\newline
Include dependency graph for tensor\+\_\+if.\+h\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=332pt]{tensor__if_8h__incl}
\end{center}
\end{figure}
This graph shows which files directly or indirectly include this file\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=344pt]{tensor__if_8h__dep__incl}
\end{center}
\end{figure}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \mbox{\hyperlink{tensor__if_8h_a0242046c8523a62b9926ec068d7117ae}{nnstreamer\+\_\+if\+\_\+custom\+\_\+register}} (const gchar $\ast$name, \mbox{\hyperlink{tensor__if_8h_a3b00dcc7093fc386ebc97f4a8d7f0a72}{tensor\+\_\+if\+\_\+custom}} func, void $\ast$\mbox{\hyperlink{gsttensor__if_8c_a3c9cc8d6e8da85fef51da4c7115b97f6}{data}})
\begin{DoxyCompactList}\small\item\em Register the custom callback function. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{tensor__if_8h_adbf1fa65b734a1daafbc8053922bda8e}{nnstreamer\+\_\+if\+\_\+custom\+\_\+unregister}} (const gchar $\ast$name)
\begin{DoxyCompactList}\small\item\em Unregister the custom callback function. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
G\+\_\+\+B\+E\+G\+I\+N\+\_\+\+D\+E\+C\+LS typedef gboolean($\ast$ \mbox{\hyperlink{tensor__if_8h_a3b00dcc7093fc386ebc97f4a8d7f0a72}{tensor\+\_\+if\+\_\+custom}} )(const \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$info, const \mbox{\hyperlink{structGstTensorMemory}{Gst\+Tensor\+Memory}} $\ast$input, void $\ast$user\+\_\+data, gboolean $\ast$\mbox{\hyperlink{gsttensor__if_8c_a13a9f04759a6e91867ba9c6301c61326}{result}})
\begin{DoxyCompactList}\small\item\em Calls the user defined conditions function. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
N\+N\+Streamer A\+P\+Is for tensor\+\_\+if custom condition. 

G\+Streamer/\+N\+N\+Streamer Tensor-\/\+IF Copyright (C) 2020 Gichan Jang \href{mailto:gichan2.jang@samsung.com}{\texttt{ gichan2.\+jang@samsung.\+com}}

\begin{DoxyDate}{Date}
28 Oct 2020 
\end{DoxyDate}
\begin{DoxySeeAlso}{See also}
\href{https://github.com/nnstreamer/nnstreamer}{\texttt{ https\+://github.\+com/nnstreamer/nnstreamer}} 
\end{DoxySeeAlso}
\begin{DoxyAuthor}{Author}
Gichan Jang \href{mailto:gichan2.jang@samsung.com}{\texttt{ gichan2.\+jang@samsung.\+com}} 
\end{DoxyAuthor}
\begin{DoxyRefDesc}{Bug}
\item[\mbox{\hyperlink{bug__bug000083}{Bug}}]No known bugs except for N\+YI items\end{DoxyRefDesc}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{tensor__if_8h_a0242046c8523a62b9926ec068d7117ae}\label{tensor__if_8h_a0242046c8523a62b9926ec068d7117ae}} 
\index{tensor\_if.h@{tensor\_if.h}!nnstreamer\_if\_custom\_register@{nnstreamer\_if\_custom\_register}}
\index{nnstreamer\_if\_custom\_register@{nnstreamer\_if\_custom\_register}!tensor\_if.h@{tensor\_if.h}}
\doxysubsubsection{\texorpdfstring{nnstreamer\_if\_custom\_register()}{nnstreamer\_if\_custom\_register()}}
{\footnotesize\ttfamily int nnstreamer\+\_\+if\+\_\+custom\+\_\+register (\begin{DoxyParamCaption}\item[{const gchar $\ast$}]{name,  }\item[{\mbox{\hyperlink{tensor__if_8h_a3b00dcc7093fc386ebc97f4a8d7f0a72}{tensor\+\_\+if\+\_\+custom}}}]{func,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Register the custom callback function. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em name} & The name of tensor\+\_\+if custom callback function. \\
\hline
\mbox{\texttt{ in}}  & {\em func} & The custom condition function body \\
\hline
 & {\em \mbox{[}in/out\mbox{]}} & data The internal data for the function \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if success. -\/E\+R\+R\+NO if error. 
\end{DoxyReturn}
\begin{DoxyNote}{Note}
Gst\+Element{\ttfamily tensor\+\_\+if\+\_\+h} can be get with {\ttfamily gst\+\_\+bin\+\_\+get\+\_\+by\+\_\+name} from the pipeline. e.\+g.,) pipeline description\+: ... ! tensor\+\_\+if name=tif (... properties ...) ! ... Gst\+Element $\ast$tensor\+\_\+if\+\_\+h = gst\+\_\+bin\+\_\+get\+\_\+by\+\_\+name (G\+S\+T\+\_\+\+B\+IN (pipeline), \char`\"{}tif\char`\"{});
\end{DoxyNote}
Register the custom callback function.

\begin{DoxyReturn}{Returns}
0 if success. -\/E\+R\+R\+NO if error. 
\end{DoxyReturn}


Definition at line 1023 of file gsttensor\+\_\+if.\+c.

Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{tensor__if_8h_a0242046c8523a62b9926ec068d7117ae_cgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{tensor__if_8h_adbf1fa65b734a1daafbc8053922bda8e}\label{tensor__if_8h_adbf1fa65b734a1daafbc8053922bda8e}} 
\index{tensor\_if.h@{tensor\_if.h}!nnstreamer\_if\_custom\_unregister@{nnstreamer\_if\_custom\_unregister}}
\index{nnstreamer\_if\_custom\_unregister@{nnstreamer\_if\_custom\_unregister}!tensor\_if.h@{tensor\_if.h}}
\doxysubsubsection{\texorpdfstring{nnstreamer\_if\_custom\_unregister()}{nnstreamer\_if\_custom\_unregister()}}
{\footnotesize\ttfamily int nnstreamer\+\_\+if\+\_\+custom\+\_\+unregister (\begin{DoxyParamCaption}\item[{const gchar $\ast$}]{name }\end{DoxyParamCaption})}



Unregister the custom callback function. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em name} & The registered name of tensor\+\_\+if custom callback function. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if success. -\/E\+R\+R\+NO if error.
\end{DoxyReturn}
Unregister the custom callback function.

\begin{DoxyReturn}{Returns}
0 if success. -\/E\+R\+R\+NO if error. 
\end{DoxyReturn}


Definition at line 1049 of file gsttensor\+\_\+if.\+c.

Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{tensor__if_8h_adbf1fa65b734a1daafbc8053922bda8e_cgraph}
\end{center}
\end{figure}


\doxysubsection{Variable Documentation}
\mbox{\Hypertarget{tensor__if_8h_a3b00dcc7093fc386ebc97f4a8d7f0a72}\label{tensor__if_8h_a3b00dcc7093fc386ebc97f4a8d7f0a72}} 
\index{tensor\_if.h@{tensor\_if.h}!tensor\_if\_custom@{tensor\_if\_custom}}
\index{tensor\_if\_custom@{tensor\_if\_custom}!tensor\_if.h@{tensor\_if.h}}
\doxysubsubsection{\texorpdfstring{tensor\_if\_custom}{tensor\_if\_custom}}
{\footnotesize\ttfamily G\+\_\+\+B\+E\+G\+I\+N\+\_\+\+D\+E\+C\+LS typedef gboolean($\ast$ tensor\+\_\+if\+\_\+custom) (const \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$info, const \mbox{\hyperlink{structGstTensorMemory}{Gst\+Tensor\+Memory}} $\ast$input, void $\ast$user\+\_\+data, gboolean $\ast$\mbox{\hyperlink{gsttensor__if_8c_a13a9f04759a6e91867ba9c6301c61326}{result}})}



Calls the user defined conditions function. 

S\+E\+C\+T\+I\+ON\+:element-\/tensor\+\_\+if

How To for N\+Ndevelopers\+:

Define the function in the app.
\begin{DoxyEnumerate}
\item Define struct, \char`\"{}tensor\+\_\+if\+\_\+custom\char`\"{}, with the functions defined.
\item Register the struct with \char`\"{}nnstreamer\+\_\+if\+\_\+custom\+\_\+register\char`\"{} A\+PI.
\item Construct the nnstreamer pipeline and execute it in the app.
\end{DoxyEnumerate}

Usage example of the tensor\+\_\+if custom condition 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{comment}{// Define custom callback function describing the condition}}
\DoxyCodeLine{gboolean tensor\_if\_custom\_cb (\textcolor{keyword}{const} \mbox{\hyperlink{structGstTensorsInfo}{GstTensorsInfo}} *info,}
\DoxyCodeLine{    \textcolor{keyword}{const} \mbox{\hyperlink{structGstTensorMemory}{GstTensorMemory}} * input, gboolean * \mbox{\hyperlink{gsttensor__if_8c_a13a9f04759a6e91867ba9c6301c61326}{result}}) \{}
\DoxyCodeLine{  \textcolor{comment}{// Describe the conditions and pass the results}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{...}
\DoxyCodeLine{\textcolor{comment}{// Register custom callback function describing the condition}}
\DoxyCodeLine{nnstreamer\_if\_custom\_register (\textcolor{stringliteral}{"tifx"}, tensor\_if\_custom\_cb, NULL);}
\DoxyCodeLine{...}
\DoxyCodeLine{\textcolor{comment}{// Use the condition in a pipeline.}}
\DoxyCodeLine{\textcolor{comment}{// E.g., Pipeline of " ... ! tensor\_if compared-\/value=CUSTOM compared-\/value-\/option=tifx then=TENSORPICK then-\/option=0 else=TENSORPICK else-\/option=1 ! ... "}}
\DoxyCodeLine{...}
\DoxyCodeLine{\textcolor{comment}{// After everything is done.}}
\DoxyCodeLine{\mbox{\hyperlink{gsttensor__if_8c_adbf1fa65b734a1daafbc8053922bda8e}{nnstreamer\_if\_custom\_unregister}} (\textcolor{stringliteral}{"tifx"});}
\end{DoxyCode}
 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em info} & input tensors info \\
\hline
\mbox{\texttt{ in}}  & {\em input} & memory containing input tensor data \\
\hline
\mbox{\texttt{ in}}  & {\em user\+\_\+data} & private data for the callback \\
\hline
\mbox{\texttt{ out}}  & {\em result} & result of the user defined condition \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
T\+R\+UE if there is no error. 
\end{DoxyReturn}


Definition at line 63 of file tensor\+\_\+if.\+h.

