The Tensor Processing API encompasses all NvMedia tensor related functionality.
Data Structures | |
| struct | NvMediaTensorTaskStatus |
| Holds the status of the latest operation for a tensor. More... | |
| struct | NvMediaTensorAttr |
| Holds tensor creation attributes. More... | |
| struct | NvMediaTensorSurfaceMap |
| Defines the tensor surface map descriptor used by NvMediaTensorLock(). More... | |
Macros | |
| #define | NVMEDIA_TENSOR_VERSION_MAJOR (1u) |
| Major version number. More... | |
| #define | NVMEDIA_TENSOR_VERSION_MINOR (13u) |
| Minor version number. More... | |
| #define | NVMTENSOR_4D_MAX_N (65536u) |
| Defines the maximum supported number of tensor surfaces. More... | |
| #define | NVMTENSOR_4D_MAX_C (8192u) |
| Defines the maximum supported number of channels of a 4D tensor. More... | |
| #define | NVMTENSOR_4D_MAX_H (8192u) |
| Defines the maximum supported height of a 4D tensor. More... | |
| #define | NVMTENSOR_4D_MAX_W (8192u) |
| Defines the maximum supported width of a 4D tensor. More... | |
| #define | NVMTENSOR_4D_MAX_X (1024u) |
| Defines the maximum supported x value of a 4D tensor. More... | |
| #define | NVMEDIA_TENSOR_TIMEOUT_INFINITE |
| This macro tells NvMediaTensorGetStatus() and NvMediaTensorLock() APIs to block infinitely till the operation finishes. More... | |
| #define | NVM_TENSOR_ATTR_CPU_ACCESS_UNCACHED (0x00000001u) |
| Specifies that the tensor CPU accesses are uncached. More... | |
| #define | NVM_TENSOR_ATTR_CPU_ACCESS_CACHED (0x00000002u) |
| Specifies that the tensor CPU accesses are cacheable. More... | |
| #define | NVM_TENSOR_ATTR_CPU_ACCESS_UNMAPPED (0x00000003u) |
| Specifies that the tensor CPU accesses are unmapped from the virtual address space of the current process. More... | |
| #define | NVM_TENSOR_ATTR_ALLOC_NONE (0x00000000u) |
| Specifies that the tensor allocation is on Soc DRAM. More... | |
| #define | NVM_TENSOR_INIT_ATTR(x) |
| A helper macro to initialize tensor creation attributes. More... | |
| #define | NVM_TENSOR_DEFINE_ATTR(x) |
| A helper macro to define tensor creation attributes. More... | |
| #define | NVM_TENSOR_SET_ATTR_4D(attr, N, C, H, W, order, datatype, bpe, accesstype, alloctype, X) |
| A helper macro to set 4-D tensor creation attributes. More... | |
Typedefs | |
| typedef struct NvMediaTensor | NvMediaTensor |
| A handle representing tensor objects. More... | |
Enumerations | |
| enum | NvMediaTensorAttrType { NVM_TENSOR_ATTR_DATA_TYPE = 0, NVM_TENSOR_ATTR_BITS_PER_ELEMENT, NVM_TENSOR_ATTR_DIMENSION_ORDER, NVM_TENSOR_ATTR_CPU_ACCESS, NVM_TENSOR_ATTR_ALLOC_TYPE, NVM_TENSOR_ATTR_4D_N, NVM_TENSOR_ATTR_4D_C, NVM_TENSOR_ATTR_4D_H, NVM_TENSOR_ATTR_4D_W, NVM_TENSOR_ATTR_4D_X, NVM_TENSOR_ATTR_MAX } |
| Defines attribute types for creating NvMedia Tensor. More... | |
Functions | |
| void | NvMediaTensorDestroy (NvMediaTensor *tensor) |
| Destroys a tensor object previously created by NvMediaTensorCreateFromNvSciBuf(). More... | |
| NvMediaStatus | NvMediaTensorGetStatus (NvMediaTensor *tensor, uint32_t millisecondWait, NvMediaTensorTaskStatus *status) |
| Gets the status of the last operation for the tensor, and optionally waits for the operation to complete or time out. More... | |
| NvMediaStatus | NvMediaTensorGetMetaData (const NvMediaTensor *tensor, NvMediaTensorMetaData *tensormetadata) |
| Fills in the metadata information for the tensor. More... | |
| NvMediaStatus | NvMediaTensorGetVersion (NvMediaVersion *version) |
| Returns version information for the NvMediaTensor library. More... | |
| #define NVM_TENSOR_ATTR_ALLOC_NONE (0x00000000u) |
Specifies that the tensor allocation is on Soc DRAM.
Definition at line 143 of file nvmedia_tensor.h.
| #define NVM_TENSOR_ATTR_CPU_ACCESS_CACHED (0x00000002u) |
Specifies that the tensor CPU accesses are cacheable.
In this case, the tensor memory will be mapped and can be accessed with a mapping into the current process's virtual address space.
Definition at line 125 of file nvmedia_tensor.h.
| #define NVM_TENSOR_ATTR_CPU_ACCESS_UNCACHED (0x00000001u) |
Specifies that the tensor CPU accesses are uncached.
In this case, the tensor memory will be mapped and can be accessed with a mapping into the current process's virtual address space.
Definition at line 119 of file nvmedia_tensor.h.
| #define NVM_TENSOR_ATTR_CPU_ACCESS_UNMAPPED (0x00000003u) |
Specifies that the tensor CPU accesses are unmapped from the virtual address space of the current process.
Definition at line 130 of file nvmedia_tensor.h.
| #define NVM_TENSOR_DEFINE_ATTR | ( | x | ) |
A helper macro to define tensor creation attributes.
Definition at line 195 of file nvmedia_tensor.h.
| #define NVM_TENSOR_INIT_ATTR | ( | x | ) |
A helper macro to initialize tensor creation attributes.
| x | The array to initialize with tensor creation attributes. |
Definition at line 159 of file nvmedia_tensor.h.
| #define NVM_TENSOR_SET_ATTR_4D | ( | attr, | |
| N, | |||
| C, | |||
| H, | |||
| W, | |||
| order, | |||
| datatype, | |||
| bpe, | |||
| accesstype, | |||
| alloctype, | |||
| X | |||
| ) |
A helper macro to set 4-D tensor creation attributes.
The attr parameter must be defined before setting the values using NVM_TENSOR_SET_ATTR_4D. For example, to set the attributes for NCHW 4-D FP16 tensor:
| attr | The attribute to set. |
| N | A tensor layout dimension for number of surfaces. |
| C | A tensor layout dimension for number of channels on the surface. |
| H | A tensor layout dimension for the height of the surface. |
| W | A tensor layout dimension for the width of the surface. |
| order | The order of the tensor elements. |
| datatype | The datatype for this tensor. |
| bpe | Specifies the bits per element. |
| accesstype | Specifies the access type. |
| alloctype | Specifies the allocation type. |
| X | A tensor layout dimension for X. |
Definition at line 221 of file nvmedia_tensor.h.
| #define NVMEDIA_TENSOR_TIMEOUT_INFINITE |
This macro tells NvMediaTensorGetStatus() and NvMediaTensorLock() APIs to block infinitely till the operation finishes.
Definition at line 65 of file nvmedia_tensor.h.
| #define NVMEDIA_TENSOR_VERSION_MAJOR (1u) |
Major version number.
Definition at line 45 of file nvmedia_tensor.h.
| #define NVMEDIA_TENSOR_VERSION_MINOR (13u) |
Minor version number.
Definition at line 47 of file nvmedia_tensor.h.
| #define NVMTENSOR_4D_MAX_C (8192u) |
Defines the maximum supported number of channels of a 4D tensor.
Definition at line 52 of file nvmedia_tensor.h.
| #define NVMTENSOR_4D_MAX_H (8192u) |
Defines the maximum supported height of a 4D tensor.
Definition at line 54 of file nvmedia_tensor.h.
| #define NVMTENSOR_4D_MAX_N (65536u) |
Defines the maximum supported number of tensor surfaces.
Definition at line 50 of file nvmedia_tensor.h.
| #define NVMTENSOR_4D_MAX_W (8192u) |
Defines the maximum supported width of a 4D tensor.
Definition at line 56 of file nvmedia_tensor.h.
| #define NVMTENSOR_4D_MAX_X (1024u) |
Defines the maximum supported x value of a 4D tensor.
This value is only for NCxHWx order.
Definition at line 58 of file nvmedia_tensor.h.
| typedef struct NvMediaTensor NvMediaTensor |
A handle representing tensor objects.
Definition at line 81 of file nvmedia_tensor.h.
Defines attribute types for creating NvMedia Tensor.
The maximum supported NvMediaTensor size is (UINT32_MAX) = 4294967295 bytes.
Definition at line 87 of file nvmedia_tensor.h.
| void NvMediaTensorDestroy | ( | NvMediaTensor * | tensor | ) |
Destroys a tensor object previously created by NvMediaTensorCreateFromNvSciBuf().
| [in] | tensor | The tensor to destroy. |
Usage considerations
| NvMediaStatus NvMediaTensorGetMetaData | ( | const NvMediaTensor * | tensor, |
| NvMediaTensorMetaData * | tensormetadata | ||
| ) |
Fills in the metadata information for the tensor.
| [in] | tensor | The tensor object to get metadata from. |
| [in,out] | tensormetadata | A pointer to a NvMediaTensorMetaData structure where tensor metadata is copied. |
| NVMEDIA_STATUS_OK | if the function is successful. |
| NVMEDIA_STATUS_BAD_PARAMETER | if any of the arguments are NULL or invalid. |
Usage considerations
| NvMediaStatus NvMediaTensorGetStatus | ( | NvMediaTensor * | tensor, |
| uint32_t | millisecondWait, | ||
| NvMediaTensorTaskStatus * | status | ||
| ) |
Gets the status of the last operation for the tensor, and optionally waits for the operation to complete or time out.
| [in] | tensor | The handle to the tensor object. |
| [in] | millisecondWait | Time in milliseconds to wait for the operation to complete before getting the status. Recommended value is NVMEDIA_TENSOR_TIMEOUT_INFINITE. |
| [out] | status | The status of the operation. |
| NVMEDIA_STATUS_OK | if the function is successful. |
| NVMEDIA_STATUS_ERROR | if an error occurred. |
| NVMEDIA_STATUS_BAD_PARAMETER | if any of the arguments are NULL or invalid. |
Usage considerations
| NvMediaStatus NvMediaTensorGetVersion | ( | NvMediaVersion * | version | ) |
Returns version information for the NvMediaTensor library.
| [out] | version | A pointer to a structure in which the function may store version information. |
| NVMEDIA_STATUS_OK | if the function call is successful. |
| NVMEDIA_STATUS_BAD_PARAMETER | if version is invalid. |
Usage considerations