Common header file for NNStreamer, the GStreamer plugin for neural networks. More...
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Classes | |
union | tensor_element |
To make the code simple with all the types. "C++ Template"-like. More... | |
struct | GstTensorMemory |
The unit of each data tensors. It will be used as an input/output tensor of other/tensors. More... | |
struct | GstTensorInfo |
Internal data structure for tensor info. More... | |
struct | GstTensorsInfo |
Internal meta data exchange format for a other/tensors instance. More... | |
struct | GstTensorsConfig |
Internal data structure for configured tensors info (for other/tensors). More... | |
struct | GstSparseTensorInfo |
Internal data structure for sparse tensor info. More... | |
struct | GstTensorMetaInfo |
Data structure to describe a tensor data. This represents the basic information of a memory block for tensor stream. More... | |
Macros | |
#define | NNS_TENSOR_RANK_LIMIT (16) |
#define | NNS_TENSOR_SIZE_LIMIT (256) |
The number of tensors NNStreamer supports is 256. The max memories of gst-buffer is 16 (See NNS_TENSOR_MEMORY_MAX). Internally NNStreamer handles the memories as tensors. If the number of tensors is larger than 16, we modify the last memory and combine tensors into the memory. More... | |
#define | NNS_TENSOR_SIZE_LIMIT_STR "256" |
#define | NNS_TENSOR_MEMORY_MAX (16) |
This value, 16, can be checked with gst_buffer_get_max_memory(), which is GST_BUFFER_MEM_MAX in gstreamer/gstbuffer.c. We redefined the value because GST_BUFFER_MEM_MAX is not exported and we need static value. To modify (increase) this value, you need to update gstreamer/gstbuffer.c as well. More... | |
#define | NNS_TENSOR_SIZE_EXTRA_LIMIT (NNS_TENSOR_SIZE_LIMIT - NNS_TENSOR_MEMORY_MAX) |
Max number of extra tensors. More... | |
#define | NNS_MIMETYPE_TENSOR "other/tensor" |
#define | NNS_MIMETYPE_TENSORS "other/tensors" |
#define | GST_TENSOR_NUM_TENSORS_RANGE "(int) [ 1, " NNS_TENSOR_SIZE_LIMIT_STR " ]" |
#define | GST_TENSOR_RATE_RANGE "(fraction) [ 0, max ]" |
#define | GST_TENSOR_TYPE_ALL "{ float16, float32, float64, int64, uint64, int32, uint32, int16, uint16, int8, uint8 }" |
Possible tensor element types. More... | |
#define | GST_TENSOR_FORMAT_ALL "{ static, flexible, sparse }" |
Possible tensor formats. More... | |
#define | GST_TENSOR_CAP_DEFAULT |
Default static capability for other/tensor. More... | |
#define | GST_TENSORS_CAP_MAKE(fmt) |
Caps string for the caps template of tensor stream. format should be a string that describes the data format, or possible formats of incoming tensor. More... | |
#define | GST_TENSORS_CAP_WITH_NUM(num) |
Caps string for the caps template (other/tensors, static tensor stream with fixed number of tensors). num should be a string format that describes the number of tensors, or the range of incoming tensors. The types and dimensions of tensors should be described for caps negotiation. More... | |
#define | GST_TENSORS_CAP_DEFAULT GST_TENSORS_CAP_WITH_NUM (GST_TENSOR_NUM_TENSORS_RANGE) |
Caps string for the caps template of static tensor stream. More... | |
#define | GST_TENSORS_FLEX_CAP_DEFAULT GST_TENSORS_CAP_MAKE ("flexible") |
Caps string for the caps template of flexible tensors. This mimetype handles non-static, flexible tensor stream without specifying the data type and shape of the tensor. The maximum number of tensors in a buffer is 16 (NNS_TENSOR_SIZE_LIMIT). More... | |
#define | GST_TENSORS_SPARSE_CAP_DEFAULT GST_TENSORS_CAP_MAKE ("sparse") |
Caps string for the caps template of sparse tensors. This mimetype handles non-static, sparse tensor stream without specifying the data type and shape of the tensor. The maximum number of tensors in a buffer is 16 (NNS_TENSOR_SIZE_LIMIT). More... | |
Typedefs | |
typedef enum _nns_tensor_type | tensor_type |
Possible data element types of other/tensor. More... | |
typedef enum _nns_media_type | media_type |
Float16 compiler extension support. More... | |
typedef enum _tensor_format | tensor_format |
Data format of tensor stream in the pipeline. More... | |
typedef enum _nns_tensor_layout | tensor_layout |
Tensor layout format for other/tensor. More... | |
typedef uint32_t | tensor_dim[NNS_TENSOR_RANK_LIMIT] |
Enumerations | |
enum | _nns_tensor_type { _NNS_INT32 = 0, _NNS_UINT32, _NNS_INT16, _NNS_UINT16, _NNS_INT8, _NNS_UINT8, _NNS_FLOAT64, _NNS_FLOAT32, _NNS_INT64, _NNS_UINT64, _NNS_FLOAT16, _NNS_END } |
Possible data element types of other/tensor. More... | |
enum | _nns_media_type { _NNS_MEDIA_INVALID = -1, _NNS_VIDEO = 0, _NNS_AUDIO = 1, _NNS_TEXT = 2, _NNS_OCTET = 3, _NNS_TENSOR = 4, _NNS_MEDIA_ANY = 0x1000 } |
Float16 compiler extension support. More... | |
enum | _tensor_format { _NNS_TENSOR_FORMAT_STATIC = 0, _NNS_TENSOR_FORMAT_FLEXIBLE, _NNS_TENSOR_FORMAT_SPARSE, _NNS_TENSOR_FORMAT_END } |
Data format of tensor stream in the pipeline. More... | |
enum | _nns_tensor_layout { _NNS_LAYOUT_ANY = 0, _NNS_LAYOUT_NHWC, _NNS_LAYOUT_NCHW, _NNS_LAYOUT_NONE } |
Tensor layout format for other/tensor. More... | |
Common header file for NNStreamer, the GStreamer plugin for neural networks.
NNStreamer Common Header, Typedef part, for export as devel package. Copyright (C) 2018 MyungJoo Ham myung joo. ham@s amsu ng.co m
This library is free software; you can redistribute it and/or modify it under the terms of the GNU 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 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
To Packagers:
This file is to be packaged as "devel" package for NN developers.
Definition in file tensor_typedef.h.
#define GST_TENSOR_CAP_DEFAULT |
Default static capability for other/tensor.
Definition at line 78 of file tensor_typedef.h.
#define GST_TENSOR_FORMAT_ALL "{ static, flexible, sparse }" |
Possible tensor formats.
Definition at line 73 of file tensor_typedef.h.
#define GST_TENSOR_NUM_TENSORS_RANGE "(int) [ 1, " NNS_TENSOR_SIZE_LIMIT_STR " ]" |
Definition at line 62 of file tensor_typedef.h.
#define GST_TENSOR_RATE_RANGE "(fraction) [ 0, max ]" |
Definition at line 63 of file tensor_typedef.h.
#define GST_TENSOR_TYPE_ALL "{ float16, float32, float64, int64, uint64, int32, uint32, int16, uint16, int8, uint8 }" |
Possible tensor element types.
Definition at line 68 of file tensor_typedef.h.
#define GST_TENSORS_CAP_DEFAULT GST_TENSORS_CAP_WITH_NUM (GST_TENSOR_NUM_TENSORS_RANGE) |
Caps string for the caps template of static tensor stream.
Definition at line 115 of file tensor_typedef.h.
#define GST_TENSORS_CAP_MAKE | ( | fmt | ) |
Caps string for the caps template of tensor stream. format should be a string that describes the data format, or possible formats of incoming tensor.
type should be one of types in GST_TENSOR_TYPE_ALL "type = (string) uint8" dimension should be a formatted string with rank NNS_TENSOR_RANK_LIMIT "dimension = (string) dim1:dim2:dim3:dim4" If the data format is static, another tensor information should be described in caps.
Definition at line 97 of file tensor_typedef.h.
#define GST_TENSORS_CAP_WITH_NUM | ( | num | ) |
Caps string for the caps template (other/tensors, static tensor stream with fixed number of tensors). num should be a string format that describes the number of tensors, or the range of incoming tensors. The types and dimensions of tensors should be described for caps negotiation.
Definition at line 107 of file tensor_typedef.h.
#define GST_TENSORS_FLEX_CAP_DEFAULT GST_TENSORS_CAP_MAKE ("flexible") |
Caps string for the caps template of flexible tensors. This mimetype handles non-static, flexible tensor stream without specifying the data type and shape of the tensor. The maximum number of tensors in a buffer is 16 (NNS_TENSOR_SIZE_LIMIT).
Definition at line 123 of file tensor_typedef.h.
#define GST_TENSORS_SPARSE_CAP_DEFAULT GST_TENSORS_CAP_MAKE ("sparse") |
Caps string for the caps template of sparse tensors. This mimetype handles non-static, sparse tensor stream without specifying the data type and shape of the tensor. The maximum number of tensors in a buffer is 16 (NNS_TENSOR_SIZE_LIMIT).
Definition at line 131 of file tensor_typedef.h.
#define NNS_MIMETYPE_TENSOR "other/tensor" |
Definition at line 59 of file tensor_typedef.h.
#define NNS_MIMETYPE_TENSORS "other/tensors" |
Definition at line 60 of file tensor_typedef.h.
#define NNS_TENSOR_MEMORY_MAX (16) |
This value, 16, can be checked with gst_buffer_get_max_memory(), which is GST_BUFFER_MEM_MAX in gstreamer/gstbuffer.c. We redefined the value because GST_BUFFER_MEM_MAX is not exported and we need static value. To modify (increase) this value, you need to update gstreamer/gstbuffer.c as well.
Definition at line 52 of file tensor_typedef.h.
#define NNS_TENSOR_RANK_LIMIT (16) |
Definition at line 34 of file tensor_typedef.h.
#define NNS_TENSOR_SIZE_EXTRA_LIMIT (NNS_TENSOR_SIZE_LIMIT - NNS_TENSOR_MEMORY_MAX) |
Max number of extra tensors.
Definition at line 57 of file tensor_typedef.h.
#define NNS_TENSOR_SIZE_LIMIT (256) |
The number of tensors NNStreamer supports is 256. The max memories of gst-buffer is 16 (See NNS_TENSOR_MEMORY_MAX). Internally NNStreamer handles the memories as tensors. If the number of tensors is larger than 16, we modify the last memory and combine tensors into the memory.
Definition at line 42 of file tensor_typedef.h.
#define NNS_TENSOR_SIZE_LIMIT_STR "256" |
Definition at line 43 of file tensor_typedef.h.
typedef enum _nns_media_type media_type |
Float16 compiler extension support.
Possible input stream types for other/tensor.
This is related with media input stream to other/tensor. There is no restrictions for the outputs.
In order to prevent enum-mix issues between device profiles, we explicitly define numbers for each enum type.
typedef uint32_t tensor_dim[NNS_TENSOR_RANK_LIMIT] |
Definition at line 247 of file tensor_typedef.h.
typedef enum _tensor_format tensor_format |
Data format of tensor stream in the pipeline.
typedef enum _nns_tensor_layout tensor_layout |
Tensor layout format for other/tensor.
The layout is needed by some of the element to appropriately process the data based on the axis of the channel in the data. Layout information will be currently utilized by only some of the elements (SNAP, NNFW in tensor_filter, PADDING mode in tensor_transform)
Tensor layout is not part of the capabilities of the element, and does not take part in the caps negotiation.
NONE layout implies that the layout of the data is neither NHWC nor NCHW. ' However, ANY layout implies that the layout of the provided data is not relevant.
typedef enum _nns_tensor_type tensor_type |
Possible data element types of other/tensor.
enum _nns_media_type |
Float16 compiler extension support.
Possible input stream types for other/tensor.
This is related with media input stream to other/tensor. There is no restrictions for the outputs.
In order to prevent enum-mix issues between device profiles, we explicitly define numbers for each enum type.
Definition at line 179 of file tensor_typedef.h.
enum _nns_tensor_layout |
Tensor layout format for other/tensor.
The layout is needed by some of the element to appropriately process the data based on the axis of the channel in the data. Layout information will be currently utilized by only some of the elements (SNAP, NNFW in tensor_filter, PADDING mode in tensor_transform)
Tensor layout is not part of the capabilities of the element, and does not take part in the caps negotiation.
NONE layout implies that the layout of the data is neither NHWC nor NCHW. ' However, ANY layout implies that the layout of the provided data is not relevant.
Definition at line 220 of file tensor_typedef.h.
enum _nns_tensor_type |
Possible data element types of other/tensor.
Definition at line 138 of file tensor_typedef.h.
enum _tensor_format |
Data format of tensor stream in the pipeline.
Enumerator | |
---|---|
_NNS_TENSOR_FORMAT_STATIC | |
_NNS_TENSOR_FORMAT_FLEXIBLE | |
_NNS_TENSOR_FORMAT_SPARSE | |
_NNS_TENSOR_FORMAT_END |
Definition at line 193 of file tensor_typedef.h.