Doxygen Book
gsttensor_sparseutil.c File Reference

Util functions for tensor_sparse encoder and decoder. More...

#include <string.h>
#include <tensor_common.h>
#include <tensor_data.h>
#include "gsttensor_sparseutil.h"
Include dependency graph for gsttensor_sparseutil.c:

Go to the source code of this file.

Functions

GstMemory * gst_tensor_sparse_to_dense (GstTensorMetaInfo *meta, GstMemory *mem)
 Make dense tensor with input sparse tensor. More...
 
GstMemory * gst_tensor_sparse_from_dense (GstTensorMetaInfo *meta, GstMemory *mem)
 Make sparse tensor with input dense tensor. More...
 

Detailed Description

Util functions for tensor_sparse encoder and decoder.

GStreamer / NNStreamer Sparse Tensor support Copyright (C) 2021 Yongjoo Ahn yongj.nosp@m.oo1..nosp@m.ahn@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m

Date
27 Jul 2021
See also
https://github.com/nnstreamer/nnstreamer
Author
Yongjoo Ahn yongj.nosp@m.oo1..nosp@m.ahn@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m
Bug:
No known bugs except for NYI items

Definition in file gsttensor_sparseutil.c.

Function Documentation

◆ gst_tensor_sparse_from_dense()

GstMemory* gst_tensor_sparse_from_dense ( GstTensorMetaInfo meta,
GstMemory *  mem 
)

Make sparse tensor with input dense tensor.

Parameters
[in,out]metatensor meta structure to be updated
[in]memgst-memory of dense tensor data
Returns
pointer of GstMemory with sparse tensor data or NULL on error. Caller should handle this newly allocated memory.

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:
Here is the caller graph for this function:

◆ gst_tensor_sparse_to_dense()

GstMemory* gst_tensor_sparse_to_dense ( GstTensorMetaInfo meta,
GstMemory *  mem 
)

Make dense tensor with input sparse tensor.

Parameters
[in,out]metatensor meta structure to be updated
[in]memgst-memory of sparse tensor data
Returns
pointer of GstMemory with dense tensor data or NULL on error. Caller should handle this newly allocated memory.

Definition at line 27 of file gsttensor_sparseutil.c.

Here is the call graph for this function:
Here is the caller graph for this function: