## Detailed Description

The NvMedia Tensor Metadata API encompasses all NvMedia Tensor metadata processing.

Tensor metadata processing follows the producer/consumer model:

• The producer must first populate the NvMediaTensorMetaData structure using producer metadata APIs.
• The producer posts the tensor.
• On the CUDA consumer side, the consumer acquires the metadata and the CUgraphicsResource, to form the tensor in the CUDA domain.

## Modules

Dimension Indices - NCHW

Dimension Indices - NCxHWx

Dimension Indices - NHWC

Stride Indices - NCHW
For NCHW tensor, assuming p,q,r,s correspond to N,C,H,W dimensions, the offset from the base address of the tensor to access a tensor value at coordinate (p,q,r,s) is calculated using the expression below:

Stride Indices - NCxHWx
For NCxHWx tensor, assuming p,q,r,s correspond to N,C,H,W dimensions, the offset from the base address of the tensor to access a tensor value at coordinate (p,q,r,s) is calculated using the expression below:

Stride Indices - NHWC
For the NHWC tensor, assuming p,q,r,s correspond to N,H,W,C dimensions, the offset from the base address of the tensor to access a tensor value at coordinate (p,q,r,s) is calculated using the expression below:

Stride and Dimension Indices
The application can use the stride and dimension indices defined below to access the strides and sizes from the corresponding arrays.

## Macros

#define NVMEDIA_TENSOR_MAX_DIMENSIONS   (8u)
Defines the maximum number of tensor dimensions. More...

#define NVM_TENSOR_ATTR_DIMENSION_ORDER_NHWC   (0x00000001u)
NVM_TENSOR_ATTR_DIMENSION_ORDER flags. More...

#define NVM_TENSOR_ATTR_DIMENSION_ORDER_NCHW   (0x00000002u)
Specifies the NCHW dimension order for 4-D tensors. More...

#define NVM_TENSOR_ATTR_DIMENSION_ORDER_NCxHWx   (0x00000003u)
Specifies the NCxHWCx dimension order for 4-D tensors. More...

#define NVM_TENSOR_ATTR_DATA_TYPE_UINT   (0x00000001u)
Specifies the unsigned integer tensor data type. More...

#define NVM_TENSOR_ATTR_DATA_TYPE_INT   (0x00000002u)
Specifies the integer tensor data type. More...

#define NVM_TENSOR_ATTR_DATA_TYPE_FLOAT   (0x00000003u)
Specifies the float tensor data type. More...

#define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_64   (64U)
Indicates that each element is 64 bits wide. More...

#define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_32   (32U)
Indicates that each element is 32 bits wide. More...

#define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_16   (16U)
Indicates that each element is 16 bits wide. More...

#define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_8   (8U)
Indicates that each element is 8 bits wide. More...

## Macro Definition Documentation

 #define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_16   (16U)

Indicates that each element is 16 bits wide.

Definition at line 63 of file nvmedia_tensormetadata.h.

 #define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_32   (32U)

Indicates that each element is 32 bits wide.

Definition at line 61 of file nvmedia_tensormetadata.h.

 #define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_64   (64U)

Indicates that each element is 64 bits wide.

Definition at line 59 of file nvmedia_tensormetadata.h.

 #define NVM_TENSOR_ATTR_BITS_PER_ELEMENT_8   (8U)

Indicates that each element is 8 bits wide.

Definition at line 65 of file nvmedia_tensormetadata.h.

 #define NVM_TENSOR_ATTR_DATA_TYPE_FLOAT   (0x00000003u)

Specifies the float tensor data type.

Definition at line 56 of file nvmedia_tensormetadata.h.

 #define NVM_TENSOR_ATTR_DATA_TYPE_INT   (0x00000002u)

Specifies the integer tensor data type.

Definition at line 54 of file nvmedia_tensormetadata.h.

 #define NVM_TENSOR_ATTR_DATA_TYPE_UINT   (0x00000001u)

Specifies the unsigned integer tensor data type.

Definition at line 52 of file nvmedia_tensormetadata.h.

 #define NVM_TENSOR_ATTR_DIMENSION_ORDER_NCHW   (0x00000002u)

Specifies the NCHW dimension order for 4-D tensors.

Definition at line 47 of file nvmedia_tensormetadata.h.

 #define NVM_TENSOR_ATTR_DIMENSION_ORDER_NCxHWx   (0x00000003u)

Specifies the NCxHWCx dimension order for 4-D tensors.

Definition at line 49 of file nvmedia_tensormetadata.h.

 #define NVM_TENSOR_ATTR_DIMENSION_ORDER_NHWC   (0x00000001u)

NVM_TENSOR_ATTR_DIMENSION_ORDER flags.

Specifies the NHWC dimension order for 4-D tensors.

Definition at line 45 of file nvmedia_tensormetadata.h.

 #define NVMEDIA_TENSOR_MAX_DIMENSIONS   (8u)

Defines the maximum number of tensor dimensions.

Definition at line 41 of file nvmedia_tensormetadata.h.