From: MyungJoo Ham Date: Wed, 14 Nov 2018 12:22:41 +0000 (+0900) Subject: [Common] Provide union of tensor elements. X-Git-Tag: v0.0.3~87 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=daf5b3345d747ac7c6b92a639f8528633b52dbde;p=platform%2Fupstream%2Fnnstreamer.git [Common] Provide union of tensor elements. This makes C++ template-like usage of tensor elements EASIER. Signed-off-by: MyungJoo Ham --- diff --git a/gst/nnstreamer/tensor_typedef.h b/gst/nnstreamer/tensor_typedef.h index cc11d71..d37ced1 100644 --- a/gst/nnstreamer/tensor_typedef.h +++ b/gst/nnstreamer/tensor_typedef.h @@ -70,9 +70,27 @@ static const unsigned int tensor_element_size[] = { [_NNS_FLOAT32] = 4, [_NNS_INT64] = 8, [_NNS_UINT64] = 8, + + [_NNS_END] = 0, }; /** + * @brief To make the code simple with all the types. "C++ Template"-like. + */ +typedef union { + int32_t _int32_t; + uint32_t _uint32_t; + int16_t _int16_t; + uint16_t _uint16_t; + int8_t _int8_t; + uint8_t _uint8_t; + double _double; + float _float; + int64_t _int64_t; + uint64_t _uint64_t; +} tensor_element; + +/** * @brief NN Frameworks available for the tensor_filter element. */ typedef enum _nnfw_type