Skip to content

Commit

Permalink
[common] Move enum tensor_layout
Browse files Browse the repository at this point in the history
This patch moves tensor_layout enum to tensor_typedef.
tensor_layout can be used in other elements.

Signed-off-by: Yelin Jeong <[email protected]>
  • Loading branch information
niley7464 authored and myungjoo committed Jan 12, 2024
1 parent d644747 commit acb461e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
27 changes: 0 additions & 27 deletions gst/nnstreamer/include/nnstreamer_plugin_api_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,33 +101,6 @@ typedef enum
ACCL_NPU_SR = 0x4100, /**< specify device as any SR npu, if possible */
} accl_hw;

/**
* @brief Internal tensor layout format for other/tensor
*
* The layout is needed by some of the subplugins 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 sublpugins (SNAP, NNFW), and should be
* provided to use some of the subplugins (SNAP).
*
* Tensor layout is stored locally in the tensor filter element, and not shared
* with other elements in the pipeline. Thus, 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.
*
* @note Providing tensor layout can also decide acceleration to be supported
* as not all the accelerators might support all the layouts (NYI).
*/
typedef enum _nns_tensor_layout
{
_NNS_LAYOUT_ANY = 0, /**< does not care about the data layout */
_NNS_LAYOUT_NHWC, /**< NHWC: channel last layout */
_NNS_LAYOUT_NCHW, /**< NCHW: channel first layout */
_NNS_LAYOUT_NONE, /**< NONE: none of the above defined layouts */
} tensor_layout;

typedef tensor_layout tensors_layout[NNS_TENSOR_SIZE_LIMIT];

/**
Expand Down
26 changes: 26 additions & 0 deletions gst/nnstreamer/include/tensor_typedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,32 @@ typedef enum _tensor_format
_NNS_TENSOR_FORMAT_END
} tensor_format;

/**
* @brief 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.
*
* @note Providing tensor layout can also decide acceleration to be supported
* as not all the accelerators might support all the layouts (NYI).
*/
typedef enum _nns_tensor_layout
{
_NNS_LAYOUT_ANY = 0, /**< does not care about the data layout */
_NNS_LAYOUT_NHWC, /**< NHWC: channel last layout */
_NNS_LAYOUT_NCHW, /**< NCHW: channel first layout */
_NNS_LAYOUT_NONE, /**< NONE: none of the above defined layouts */
} tensor_layout;

/**
* @brief To make the code simple with all the types. "C++ Template"-like.
*/
Expand Down

0 comments on commit acb461e

Please sign in to comment.