\hypertarget{tensor__filter__custom__easy_8h}{}\doxysection{nnstreamer/include/tensor\+\_\+filter\+\_\+custom\+\_\+easy.h File Reference}
\label{tensor__filter__custom__easy_8h}\index{nnstreamer/include/tensor\_filter\_custom\_easy.h@{nnstreamer/include/tensor\_filter\_custom\_easy.h}}


Custom tensor processing interface for simple functions.  


{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include \char`\"{}tensor\+\_\+typedef.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}tensor\+\_\+filter\+\_\+custom.\+h\char`\"{}}\newline
Include dependency graph for tensor\+\_\+filter\+\_\+custom\+\_\+easy.\+h\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=294pt]{tensor__filter__custom__easy_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=235pt]{tensor__filter__custom__easy_8h__dep__incl}
\end{center}
\end{figure}
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef int($\ast$ \mbox{\hyperlink{tensor__filter__custom__easy_8h_a642d2957ce783889b73d5afb9cc16636}{N\+N\+S\+\_\+custom\+\_\+invoke\+\_\+dynamic}}) (void $\ast$private\+\_\+data, const \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$in\+\_\+info, \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$out\+\_\+info, const \mbox{\hyperlink{structGstTensorMemory}{Gst\+Tensor\+Memory}} $\ast$input, \mbox{\hyperlink{structGstTensorMemory}{Gst\+Tensor\+Memory}} $\ast$output)
\begin{DoxyCompactList}\small\item\em Invoke the \char`\"{}main function\char`\"{} with flexible input and output. Output tensor memory should be allocated. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
G\+\_\+\+B\+E\+G\+I\+N\+\_\+\+D\+E\+C\+LS int \mbox{\hyperlink{tensor__filter__custom__easy_8h_a4a2f1e162896a46c5561678a58cd0c7d}{N\+N\+S\+\_\+custom\+\_\+easy\+\_\+register}} (const char $\ast$modelname, \mbox{\hyperlink{tensor__filter__custom_8h_a9598305bb440b4f8e1685f7da067500d}{N\+N\+S\+\_\+custom\+\_\+invoke}} func, void $\ast$\mbox{\hyperlink{gsttensor__if_8c_a3c9cc8d6e8da85fef51da4c7115b97f6}{data}}, const \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$in\+\_\+info, const \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$out\+\_\+info)
\begin{DoxyCompactList}\small\item\em Register the custom-\/easy tensor function. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{tensor__filter__custom__easy_8h_a617e17cc8587e3690bc5816a73b64228}{N\+N\+S\+\_\+custom\+\_\+easy\+\_\+dynamic\+\_\+register}} (const char $\ast$modelname, \mbox{\hyperlink{tensor__filter__custom__easy_8h_a642d2957ce783889b73d5afb9cc16636}{N\+N\+S\+\_\+custom\+\_\+invoke\+\_\+dynamic}} func, void $\ast$\mbox{\hyperlink{gsttensor__if_8c_a3c9cc8d6e8da85fef51da4c7115b97f6}{data}}, const \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$in\+\_\+info)
\begin{DoxyCompactList}\small\item\em Register the custom-\/easy tensor function for dynamic invoke. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{tensor__filter__custom__easy_8h_a701757c00b46887100e566c931ece896}{N\+N\+S\+\_\+custom\+\_\+easy\+\_\+unregister}} (const char $\ast$modelname)
\begin{DoxyCompactList}\small\item\em Unregister the custom-\/easy tensor function. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Custom tensor processing interface for simple functions. 

G\+Streamer Tensor\+\_\+\+Filter, Customized Module, Easy Mode Copyright (C) 2019 Myung\+Joo Ham \href{mailto:myungjoo.ham@samsung.com}{\texttt{ myungjoo.\+ham@samsung.\+com}}

This library is free software; you can redistribute it and/or modify it under the terms of the G\+NU Library General Public License as published by the Free Software Foundation; version 2.\+1 of the License.

This library is distributed in the hope that it will be useful, but W\+I\+T\+H\+O\+UT A\+NY W\+A\+R\+R\+A\+N\+TY; without even the implied warranty of M\+E\+R\+C\+H\+A\+N\+T\+A\+B\+I\+L\+I\+TY or F\+I\+T\+N\+E\+SS F\+OR A P\+A\+R\+T\+I\+C\+U\+L\+AR P\+U\+R\+P\+O\+SE. See the G\+NU Library General Public License for more details.

\begin{DoxyDate}{Date}
24 Oct 2019 
\end{DoxyDate}
\begin{DoxySeeAlso}{See also}
\href{http://github.com/nnstreamer/nnstreamer}{\texttt{ http\+://github.\+com/nnstreamer/nnstreamer}} 
\end{DoxySeeAlso}
\begin{DoxyAuthor}{Author}
Myung\+Joo Ham \href{mailto:myungjoo.ham@samsung.com}{\texttt{ myungjoo.\+ham@samsung.\+com}} 
\end{DoxyAuthor}
\begin{DoxyRefDesc}{Bug}
\item[\mbox{\hyperlink{bug__bug000082}{Bug}}]No known bugs except for N\+YI items\end{DoxyRefDesc}


How To for N\+Ndevelopers\+:

Case 1. Provide the function as a shared object for other apps.
\begin{DoxyEnumerate}
\item Define struct, \char`\"{}\+N\+N\+Streamer\+\_\+custom\+\_\+easy\char`\"{}, with the functions defined.
\item Call \mbox{\hyperlink{tensor__filter__custom__easy_8h_a4a2f1e162896a46c5561678a58cd0c7d}{N\+N\+S\+\_\+custom\+\_\+easy\+\_\+register()}} at a global init/constructor function.
\item Compile as a shared object. (.so in Linux) And install at the custom-\/filter path.
\item Use N\+N\+Streamer (tensor\+\_\+filter framework=custom\+\_\+easy, model=\$\{modelname\}, custom=\$\{\+\_\+\+F\+I\+L\+E\+P\+A\+T\+H\+\_\+\+O\+F\+\_\+\+Y\+O\+U\+R\+\_\+\+SO\} ...)
\item Note that you may register multiple models (functions) with a single .so.
\end{DoxyEnumerate}

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

Note that this does not support flexible dimensions.

To Packagers\+:

This file is to be packaged as \char`\"{}devel\char`\"{} package for NN developers. 

\doxysubsection{Typedef Documentation}
\mbox{\Hypertarget{tensor__filter__custom__easy_8h_a642d2957ce783889b73d5afb9cc16636}\label{tensor__filter__custom__easy_8h_a642d2957ce783889b73d5afb9cc16636}} 
\index{tensor\_filter\_custom\_easy.h@{tensor\_filter\_custom\_easy.h}!NNS\_custom\_invoke\_dynamic@{NNS\_custom\_invoke\_dynamic}}
\index{NNS\_custom\_invoke\_dynamic@{NNS\_custom\_invoke\_dynamic}!tensor\_filter\_custom\_easy.h@{tensor\_filter\_custom\_easy.h}}
\doxysubsubsection{\texorpdfstring{NNS\_custom\_invoke\_dynamic}{NNS\_custom\_invoke\_dynamic}}
{\footnotesize\ttfamily typedef int($\ast$ N\+N\+S\+\_\+custom\+\_\+invoke\+\_\+dynamic) (void $\ast$private\+\_\+data, const \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$in\+\_\+info, \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$out\+\_\+info, const \mbox{\hyperlink{structGstTensorMemory}{Gst\+Tensor\+Memory}} $\ast$input, \mbox{\hyperlink{structGstTensorMemory}{Gst\+Tensor\+Memory}} $\ast$output)}



Invoke the \char`\"{}main function\char`\"{} with flexible input and output. Output tensor memory should be allocated. 


\begin{DoxyParams}[1]{Parameters}
 & {\em \mbox{[}in/out\mbox{]}} & private\+\_\+data A subplugin may save its internal private data here. The subplugin is responsible for alloc/free of this pointer. \\
\hline
\mbox{\texttt{ in}}  & {\em info} & structure of input tensors info \\
\hline
\mbox{\texttt{ out}}  & {\em info} & structure of output tensors info. The subplugin should fill this info. \\
\hline
\mbox{\texttt{ in}}  & {\em input} & The array of input tensors. Allocated and filled by tensor\+\_\+filter/main \\
\hline
\mbox{\texttt{ out}}  & {\em output} & The array of output tensors. The subplugin should allocate the memory block for output tensor. (data in \mbox{\hyperlink{structGstTensorMemory}{Gst\+Tensor\+Memory}}) \\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
rank limit (N\+N\+S\+\_\+\+T\+E\+N\+S\+O\+R\+\_\+\+R\+A\+N\+K\+\_\+\+L\+I\+M\+IT) and typesize (tensor\+\_\+element\+\_\+size) defined in \mbox{\hyperlink{tensor__typedef_8h}{tensor\+\_\+typedef.\+h}} 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
0 if success 
\end{DoxyReturn}


Definition at line 76 of file tensor\+\_\+filter\+\_\+custom\+\_\+easy.\+h.



\doxysubsection{Function Documentation}
\mbox{\Hypertarget{tensor__filter__custom__easy_8h_a617e17cc8587e3690bc5816a73b64228}\label{tensor__filter__custom__easy_8h_a617e17cc8587e3690bc5816a73b64228}} 
\index{tensor\_filter\_custom\_easy.h@{tensor\_filter\_custom\_easy.h}!NNS\_custom\_easy\_dynamic\_register@{NNS\_custom\_easy\_dynamic\_register}}
\index{NNS\_custom\_easy\_dynamic\_register@{NNS\_custom\_easy\_dynamic\_register}!tensor\_filter\_custom\_easy.h@{tensor\_filter\_custom\_easy.h}}
\doxysubsubsection{\texorpdfstring{NNS\_custom\_easy\_dynamic\_register()}{NNS\_custom\_easy\_dynamic\_register()}}
{\footnotesize\ttfamily int N\+N\+S\+\_\+custom\+\_\+easy\+\_\+dynamic\+\_\+register (\begin{DoxyParamCaption}\item[{const char $\ast$}]{modelname,  }\item[{\mbox{\hyperlink{tensor__filter__custom__easy_8h_a642d2957ce783889b73d5afb9cc16636}{N\+N\+S\+\_\+custom\+\_\+invoke\+\_\+dynamic}}}]{func,  }\item[{void $\ast$}]{data,  }\item[{const \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$}]{in\+\_\+info }\end{DoxyParamCaption})}



Register the custom-\/easy tensor function for dynamic invoke. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em modelname} & The name of custom-\/easy tensor function. \\
\hline
\mbox{\texttt{ in}}  & {\em func} & The tensor function body \\
\hline
 & {\em \mbox{[}in/out\mbox{]}} & private\+\_\+data The internal data for the function \\
\hline
\mbox{\texttt{ in}}  & {\em in\+\_\+info} & Input tensor metadata. \\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
N\+N\+S\+\_\+custom\+\_\+invoke\+\_\+dynamic defined in \mbox{\hyperlink{tensor__filter__custom_8h}{tensor\+\_\+filter\+\_\+custom.\+h}} Output buffers should be allocated in the invoke function.
\end{DoxyNote}
Register the custom-\/easy tensor function for dynamic invoke.

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


Definition at line 112 of file tensor\+\_\+filter\+\_\+custom\+\_\+easy.\+c.

Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{tensor__filter__custom__easy_8h_a617e17cc8587e3690bc5816a73b64228_cgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{tensor__filter__custom__easy_8h_a4a2f1e162896a46c5561678a58cd0c7d}\label{tensor__filter__custom__easy_8h_a4a2f1e162896a46c5561678a58cd0c7d}} 
\index{tensor\_filter\_custom\_easy.h@{tensor\_filter\_custom\_easy.h}!NNS\_custom\_easy\_register@{NNS\_custom\_easy\_register}}
\index{NNS\_custom\_easy\_register@{NNS\_custom\_easy\_register}!tensor\_filter\_custom\_easy.h@{tensor\_filter\_custom\_easy.h}}
\doxysubsubsection{\texorpdfstring{NNS\_custom\_easy\_register()}{NNS\_custom\_easy\_register()}}
{\footnotesize\ttfamily G\+\_\+\+B\+E\+G\+I\+N\+\_\+\+D\+E\+C\+LS int N\+N\+S\+\_\+custom\+\_\+easy\+\_\+register (\begin{DoxyParamCaption}\item[{const char $\ast$}]{modelname,  }\item[{\mbox{\hyperlink{tensor__filter__custom_8h_a9598305bb440b4f8e1685f7da067500d}{N\+N\+S\+\_\+custom\+\_\+invoke}}}]{func,  }\item[{void $\ast$}]{data,  }\item[{const \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$}]{in\+\_\+info,  }\item[{const \mbox{\hyperlink{structGstTensorsInfo}{Gst\+Tensors\+Info}} $\ast$}]{out\+\_\+info }\end{DoxyParamCaption})}



Register the custom-\/easy tensor function. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em modelname} & The name of custom-\/easy tensor function. \\
\hline
\mbox{\texttt{ in}}  & {\em func} & The tensor function body \\
\hline
 & {\em \mbox{[}in/out\mbox{]}} & private\+\_\+data The internal data for the function \\
\hline
\mbox{\texttt{ in}}  & {\em in\+\_\+info} & Input tensor metadata. \\
\hline
\mbox{\texttt{ in}}  & {\em out\+\_\+info} & Output tensor metadata \\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
N\+N\+S\+\_\+custom\+\_\+invoke defined in \mbox{\hyperlink{tensor__filter__custom_8h}{tensor\+\_\+filter\+\_\+custom.\+h}} Output buffers for func are preallocated.
\end{DoxyNote}
Register the custom-\/easy tensor function.

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


Definition at line 76 of file tensor\+\_\+filter\+\_\+custom\+\_\+easy.\+c.

Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{tensor__filter__custom__easy_8h_a4a2f1e162896a46c5561678a58cd0c7d_cgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{tensor__filter__custom__easy_8h_a701757c00b46887100e566c931ece896}\label{tensor__filter__custom__easy_8h_a701757c00b46887100e566c931ece896}} 
\index{tensor\_filter\_custom\_easy.h@{tensor\_filter\_custom\_easy.h}!NNS\_custom\_easy\_unregister@{NNS\_custom\_easy\_unregister}}
\index{NNS\_custom\_easy\_unregister@{NNS\_custom\_easy\_unregister}!tensor\_filter\_custom\_easy.h@{tensor\_filter\_custom\_easy.h}}
\doxysubsubsection{\texorpdfstring{NNS\_custom\_easy\_unregister()}{NNS\_custom\_easy\_unregister()}}
{\footnotesize\ttfamily int N\+N\+S\+\_\+custom\+\_\+easy\+\_\+unregister (\begin{DoxyParamCaption}\item[{const char $\ast$}]{modelname }\end{DoxyParamCaption})}



Unregister the custom-\/easy tensor function. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em modelname} & The registered name of custom-\/easy tensor function. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if success, non-\/zero if error

0 if success. -\/E\+I\+N\+V\+AL if invalid model name. 
\end{DoxyReturn}


Definition at line 144 of file tensor\+\_\+filter\+\_\+custom\+\_\+easy.\+c.

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