\hypertarget{gsttensor__sparseutil_8c}{}\doxysection{nnstreamer/elements/gsttensor\+\_\+sparseutil.c File Reference}
\label{gsttensor__sparseutil_8c}\index{nnstreamer/elements/gsttensor\_sparseutil.c@{nnstreamer/elements/gsttensor\_sparseutil.c}}


Util functions for tensor\+\_\+sparse encoder and decoder.  


{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$tensor\+\_\+common.\+h$>$}\newline
{\ttfamily \#include $<$tensor\+\_\+data.\+h$>$}\newline
{\ttfamily \#include \char`\"{}gsttensor\+\_\+sparseutil.\+h\char`\"{}}\newline
Include dependency graph for gsttensor\+\_\+sparseutil.\+c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gsttensor__sparseutil_8c__incl}
\end{center}
\end{figure}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
Gst\+Memory $\ast$ \mbox{\hyperlink{gsttensor__sparseutil_8c_a00b1382e7634dfd97091311fa4de53f1}{gst\+\_\+tensor\+\_\+sparse\+\_\+to\+\_\+dense}} (\mbox{\hyperlink{structGstTensorMetaInfo}{Gst\+Tensor\+Meta\+Info}} $\ast$meta, Gst\+Memory $\ast$mem)
\begin{DoxyCompactList}\small\item\em Make dense tensor with input sparse tensor. \end{DoxyCompactList}\item 
Gst\+Memory $\ast$ \mbox{\hyperlink{gsttensor__sparseutil_8c_af0519a5e7b73d30c1e41be91c5c18710}{gst\+\_\+tensor\+\_\+sparse\+\_\+from\+\_\+dense}} (\mbox{\hyperlink{structGstTensorMetaInfo}{Gst\+Tensor\+Meta\+Info}} $\ast$meta, Gst\+Memory $\ast$mem)
\begin{DoxyCompactList}\small\item\em Make sparse tensor with input dense tensor. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Util functions for tensor\+\_\+sparse encoder and decoder. 

G\+Streamer / N\+N\+Streamer Sparse Tensor support Copyright (C) 2021 Yongjoo Ahn \href{mailto:yongjoo1.ahn@samsung.com}{\texttt{ yongjoo1.\+ahn@samsung.\+com}}

\begin{DoxyDate}{Date}
27 Jul 2021 
\end{DoxyDate}
\begin{DoxySeeAlso}{See also}
\href{https://github.com/nnstreamer/nnstreamer}{\texttt{ https\+://github.\+com/nnstreamer/nnstreamer}} 
\end{DoxySeeAlso}
\begin{DoxyAuthor}{Author}
Yongjoo Ahn \href{mailto:yongjoo1.ahn@samsung.com}{\texttt{ yongjoo1.\+ahn@samsung.\+com}} 
\end{DoxyAuthor}
\begin{DoxyRefDesc}{Bug}
\item[\mbox{\hyperlink{bug__bug000060}{Bug}}]No known bugs except for N\+YI items \end{DoxyRefDesc}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{gsttensor__sparseutil_8c_af0519a5e7b73d30c1e41be91c5c18710}\label{gsttensor__sparseutil_8c_af0519a5e7b73d30c1e41be91c5c18710}} 
\index{gsttensor\_sparseutil.c@{gsttensor\_sparseutil.c}!gst\_tensor\_sparse\_from\_dense@{gst\_tensor\_sparse\_from\_dense}}
\index{gst\_tensor\_sparse\_from\_dense@{gst\_tensor\_sparse\_from\_dense}!gsttensor\_sparseutil.c@{gsttensor\_sparseutil.c}}
\doxysubsubsection{\texorpdfstring{gst\_tensor\_sparse\_from\_dense()}{gst\_tensor\_sparse\_from\_dense()}}
{\footnotesize\ttfamily Gst\+Memory$\ast$ gst\+\_\+tensor\+\_\+sparse\+\_\+from\+\_\+dense (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structGstTensorMetaInfo}{Gst\+Tensor\+Meta\+Info}} $\ast$}]{meta,  }\item[{Gst\+Memory $\ast$}]{mem }\end{DoxyParamCaption})}



Make sparse tensor with input dense tensor. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em meta} & tensor meta structure to be updated \\
\hline
\mbox{\texttt{ in}}  & {\em mem} & gst-\/memory of dense tensor data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer of Gst\+Memory with sparse tensor data or N\+U\+LL on error. Caller should handle this newly allocated memory. 
\end{DoxyReturn}
alloc maximum possible size of memory

Consider using macro to reduce loc and readability

update meta nnz info

write to output buffer

add meta info header

Definition at line 116 of file gsttensor\+\_\+sparseutil.\+c.

Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gsttensor__sparseutil_8c_af0519a5e7b73d30c1e41be91c5c18710_cgraph}
\end{center}
\end{figure}
Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gsttensor__sparseutil_8c_af0519a5e7b73d30c1e41be91c5c18710_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{gsttensor__sparseutil_8c_a00b1382e7634dfd97091311fa4de53f1}\label{gsttensor__sparseutil_8c_a00b1382e7634dfd97091311fa4de53f1}} 
\index{gsttensor\_sparseutil.c@{gsttensor\_sparseutil.c}!gst\_tensor\_sparse\_to\_dense@{gst\_tensor\_sparse\_to\_dense}}
\index{gst\_tensor\_sparse\_to\_dense@{gst\_tensor\_sparse\_to\_dense}!gsttensor\_sparseutil.c@{gsttensor\_sparseutil.c}}
\doxysubsubsection{\texorpdfstring{gst\_tensor\_sparse\_to\_dense()}{gst\_tensor\_sparse\_to\_dense()}}
{\footnotesize\ttfamily Gst\+Memory$\ast$ gst\+\_\+tensor\+\_\+sparse\+\_\+to\+\_\+dense (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structGstTensorMetaInfo}{Gst\+Tensor\+Meta\+Info}} $\ast$}]{meta,  }\item[{Gst\+Memory $\ast$}]{mem }\end{DoxyParamCaption})}



Make dense tensor with input sparse tensor. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em meta} & tensor meta structure to be updated \\
\hline
\mbox{\texttt{ in}}  & {\em mem} & gst-\/memory of sparse tensor data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer of Gst\+Memory with dense tensor data or N\+U\+LL on error. Caller should handle this newly allocated memory. 
\end{DoxyReturn}


Definition at line 27 of file gsttensor\+\_\+sparseutil.\+c.

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