From 3fe862cd6c838565c2ade297d2da757b80e3040c Mon Sep 17 00:00:00 2001 From: HyoungjooAhn Date: Mon, 17 Sep 2018 15:39:02 +0900 Subject: [PATCH] [Filter] create new structure for multi tensors define new structure as a standard unit of data tensor. it will be allocated and used to store tensor data Signed-off-by: HyoungjooAhn --- include/tensor_typedef.h | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/include/tensor_typedef.h b/include/tensor_typedef.h index 093dc6f..bfca16b 100644 --- a/include/tensor_typedef.h +++ b/include/tensor_typedef.h @@ -39,7 +39,8 @@ * The current version supports NNS_UINT8 only as video-input. * There is no restrictions for inter-NN or sink-to-app. */ -typedef enum _nns_tensor_type { +typedef enum _nns_tensor_type +{ _NNS_INT32 = 0, _NNS_UINT32, _NNS_INT16, @@ -58,22 +59,23 @@ typedef enum _nns_tensor_type { * @brief Byte-per-element of each tensor element type. */ static const unsigned int tensor_element_size[] = { - [_NNS_INT32] = 4, - [_NNS_UINT32] = 4, - [_NNS_INT16] = 2, - [_NNS_UINT16] = 2, - [_NNS_INT8] = 1, - [_NNS_UINT8] = 1, - [_NNS_FLOAT64] = 8, - [_NNS_FLOAT32] = 4, - [_NNS_INT64] = 8, - [_NNS_UINT64] = 8, + [_NNS_INT32] = 4, + [_NNS_UINT32] = 4, + [_NNS_INT16] = 2, + [_NNS_UINT16] = 2, + [_NNS_INT8] = 1, + [_NNS_UINT8] = 1, + [_NNS_FLOAT64] = 8, + [_NNS_FLOAT32] = 4, + [_NNS_INT64] = 8, + [_NNS_UINT64] = 8, }; /** * @brief NN Frameworks available for the tensor_filter element. */ -typedef enum _nnfw_type { +typedef enum _nnfw_type +{ _T_F_UNDEFINED = 0, /**< Not defined or supported. Cannot proceed in this status */ _T_F_CUSTOM, /**< Custom filter provided as a shared object (dysym) */ @@ -87,7 +89,8 @@ typedef enum _nnfw_type { struct _GstTensorFilterFramework; typedef struct _GstTensorFilterFramework GstTensorFilterFramework; -typedef enum { +typedef enum +{ _TFC_INIT = 0, _TFC_DIMENSION = 1, _TFC_TYPE = 2, @@ -102,6 +105,16 @@ typedef uint32_t tensor_dim[NNS_TENSOR_RANK_LIMIT]; typedef uint8_t *tensors[NNS_TENSOR_SIZE_LIMIT]; /**< Array of tensors */ /** + * @brief The unit of each data tensors. It will be used as an input/output tensor of other/tensors. + */ +typedef struct +{ + void *data; + size_t size; + tensor_type type; +} GstTensorMemory; + +/** * @brief Internal data structure for tensor info. */ typedef struct -- 2.7.4