NVIDIA DRIVE OS Linux SDK API Reference

5.1.9.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Tensor Handling API

Detailed Description

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   (3u)
 Minor version number. More...
 
#define NVMEDIA_TENSOR_TIMEOUT_INFINITE
 Infinite time-out for NvMediaTensorGetStatus() More...
 
#define NVM_TENSOR_ATTR_CPU_ACCESS_UNCACHED   (0x00000001u)
 Specifies that the tensor CPU accesses are uncached (mapped). More...
 
#define NVM_TENSOR_ATTR_CPU_ACCESS_CACHED   (0x00000002u)
 Specifies that the tensor CPU accesses are cacheable (mapped). 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_RESERVED   (0x00000010u)
 Specifies that the tensor allocation is on CVRAM. 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 *tensorDesc)
 Destroys a tensor object previously created by NvMediaTensorCreateFromNvSciBuf(). More...
 
NvMediaStatus NvMediaTensorGetStatus (NvMediaTensor *tensor, uint32_t millisecondWait, NvMediaTensorTaskStatus *status)
 Gets the status of the current/last operation for the tensor, and optionally waits for the operation to complete or time out. More...
 
NvMediaStatus NvMediaTensorGetMetaData (NvMediaTensor *tensor, NvMediaTensorMetaData *tensormetadata)
 Fills in the metadata information for the tensor. More...
 

Macro Definition Documentation

#define NVM_TENSOR_ATTR_ALLOC_NONE   (0x00000000u)

Specifies that the tensor allocation is on Soc DRAM.

Definition at line 126 of file nvmedia_tensor.h.

#define NVM_TENSOR_ATTR_ALLOC_RESERVED   (0x00000010u)

Specifies that the tensor allocation is on CVRAM.

Definition at line 122 of file nvmedia_tensor.h.

#define NVM_TENSOR_ATTR_CPU_ACCESS_CACHED   (0x00000002u)

Specifies that the tensor CPU accesses are cacheable (mapped).

Definition at line 112 of file nvmedia_tensor.h.

#define NVM_TENSOR_ATTR_CPU_ACCESS_UNCACHED   (0x00000001u)

Specifies that the tensor CPU accesses are uncached (mapped).

Definition at line 108 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 117 of file nvmedia_tensor.h.

#define NVM_TENSOR_DEFINE_ATTR (   x)
Value:
#define NVM_TENSOR_INIT_ATTR(x)
A helper macro to initialize tensor creation attributes.
Holds tensor creation attributes.
Defines the maximum number of tensor creation attributes.

A helper macro to define tensor creation attributes.

Definition at line 180 of file nvmedia_tensor.h.

#define NVM_TENSOR_INIT_ATTR (   x)

A helper macro to initialize tensor creation attributes.

Parameters
xThe array to initialize with tensor creation attributes.

Definition at line 143 of file nvmedia_tensor.h.

#define NVM_TENSOR_SET_ATTR_4D (   attr,
  N,
  C,
  H,
  W,
  order,
  datatype,
  bpe,
  accesstype,
  alloctype,
 
)

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:

NVM_TENSOR_SET_ATTR_4D(attr, N, C, H, W, NCHW, FLOAT, 16, UNCACHED, NONE, 32);
Parameters
attrThe attribute to set.
NA tensor layout dimension for number of surfaces.
CA tensor layout dimension for number of channels on the surface.
HA tensor layout dimension for the height of the surface.
WA tensor layout dimension for the width of the surface.
orderThe order of the tensor elements.
datatypeThe datatype for this tensor.
bpeSpecifies the bits per element.
accesstypeSpecifies the access type.
alloctypeSpecifies the allocation type.
XA tensor layout dimension for X.

Definition at line 205 of file nvmedia_tensor.h.

#define NVMEDIA_TENSOR_TIMEOUT_INFINITE

Infinite time-out for NvMediaTensorGetStatus()

Definition at line 53 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   (3u)

Minor version number.

Definition at line 47 of file nvmedia_tensor.h.

Typedef Documentation

typedef struct NvMediaTensor NvMediaTensor

A handle representing tensor objects.

Definition at line 69 of file nvmedia_tensor.h.

Enumeration Type Documentation

Defines attribute types for creating NvMedia Tensor.

Enumerator
NVM_TENSOR_ATTR_DATA_TYPE 

Specifies the tensor data type.

NVM_TENSOR_ATTR_BITS_PER_ELEMENT 

Defines the tensor bits per element.

NVM_TENSOR_ATTR_DIMENSION_ORDER 

Defines the tensor dimension order.

NVM_TENSOR_ATTR_CPU_ACCESS 

Defines the CPU access to tensor (default: uncached).

NVM_TENSOR_ATTR_ALLOC_TYPE 

Defines the allocation type, reserved (default: none).

NVM_TENSOR_ATTR_4D_N 

Attribute types for 4D tensors.

Defines the number of tensor surfaces.

NVM_TENSOR_ATTR_4D_C 

Defines the number of channels of a 4D tensor.

NVM_TENSOR_ATTR_4D_H 

Defines the height of a 4D tensor.

NVM_TENSOR_ATTR_4D_W 

Defines the width of a 4D tensor.

NVM_TENSOR_ATTR_4D_X 

Defines the x value of a 4D tensor.

This value is only for NCxHWx order.

NVM_TENSOR_ATTR_MAX 

Defines the maximum number of tensor creation attributes.

Definition at line 74 of file nvmedia_tensor.h.

Function Documentation

void NvMediaTensorDestroy ( NvMediaTensor tensorDesc)

Destroys a tensor object previously created by NvMediaTensorCreateFromNvSciBuf().

Parameters
[in]tensorDescThe tensor to destroy.
NvMediaStatus NvMediaTensorGetMetaData ( NvMediaTensor tensor,
NvMediaTensorMetaData tensormetadata 
)

Fills in the metadata information for the tensor.

Parameters
[in]tensorThe tensor object to get metadata from.
[in,out]tensormetadataA pointer to a NvMediaTensorMetaData structure where tensor metadata is copied.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaTensorGetStatus ( NvMediaTensor tensor,
uint32_t  millisecondWait,
NvMediaTensorTaskStatus status 
)

Gets the status of the current/last operation for the tensor, and optionally waits for the operation to complete or time out.

Parameters
[in]tensorThe handle to the tensor object.
[in]millisecondWaitTime in milliseconds to wait for the operation to complete before getting the status. Use the value NVMEDIA_TENSOR_TIMEOUT_INFINITE to wait until the operation completes before getting the status.
[out]statusThe status of the operation.
Returns
NvMediaStatus, the completion status of the operation: