NVIDIA DeepStream SDK API Reference

9.2 Release
sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/utils/tensor_init.h File Reference

Go to the source code of this file.

Functions

Tensor * createTensor (const std::string &tensor_name, const std::vector< int > &shape, NvDsDataType data_type=NvDsDataType_FP32, int gpu_id=-1)
 Creates a tensor with the specified shape, data type, and GPU ID. More...
 
void initOrgProjectionMatTensor (TensorCache *tensorCache, int batch_size, int num_sensors, const std::vector< Eigen::Matrix< float, 4, 4 >> &calib_matrices, int gpu_id)
 Initialize projection matrix tensor and update the TensorCache. More...
 
void initProjectionMatTensor (TensorCache *tensorCache, int batch_size, int num_sensors, const std::vector< Eigen::Matrix< float, 4, 4 >> &calib_matrices)
 Initializes projection matrix tensor using pre-allocated memory and updates the TensorCache. More...
 
void initImageWHTensor (TensorCache *tensorCache, int width, int height)
 Initializes image width/height tensor using pre-allocated memory and updates the TensorCache. More...
 
void initInputCachedAnchorTensor (TensorCache *tensorCache)
 Initializes cached anchor tensor using pre-allocated memory and updates the TensorCache. More...
 
void initInputCachedFeatureTensor (TensorCache *tensorCache)
 Initializes cached feature tensor using pre-allocated memory and updates the TensorCache. More...
 
void intiPrevExistsTensor (TensorCache *tensorCache, float value)
 Initializes prev_exists tensor using pre-allocated memory and updates the TensorCache. More...
 
void initIntervalMaskTensor (TensorCache *tensorCache, float value)
 Initializes interval mask tensor using pre-allocated memory and updates the TensorCache. More...
 
void initGroupOriginTensor (TensorCache *tensorCache, const std::vector< float > &group_origin)
 Initializes group origin tensor using pre-allocated memory and updates the TensorCache. More...
 
void updateInputCachedAnchorTensor (TensorCache *tensorCache, torch::Tensor anchor)
 Updates input cached anchor tensor using pre-allocated memory. More...
 
void updateInputCachedFeatureTensor (TensorCache *tensorCache, torch::Tensor feature)
 Updates input cached feature tensor using pre-allocated memory. More...
 
void updateProjectionMatrixForBatch (TensorCache *tensorCache, const std::map< std::string, Eigen::Matrix< float, 4, 4 >> &cameraMatrices, const std::vector< std::string > &currentBatchCameras, int batch_size, int num_sensors)
 Updates projection matrix tensor based on the current camera names in the batch. More...
 
void updateOrgProjectionMatrixForBatch (TensorCache *tensorCache, const std::map< std::string, Eigen::Matrix< float, 4, 4 >> &cameraMatrices, const std::vector< std::string > &currentBatchCameras, int batch_size, int num_sensors)
 Updates the original projection matrix tensor based on the current camera names in the batch. More...
 

Function Documentation

◆ createTensor()

Tensor* createTensor ( const std::string &  tensor_name,
const std::vector< int > &  shape,
NvDsDataType  data_type = NvDsDataType_FP32,
int  gpu_id = -1 
)

Creates a tensor with the specified shape, data type, and GPU ID.

Parameters
tensor_nameName for the tensor
shapeVector of dimensions for the tensor shape
data_typeData type for the tensor (defaults to FP32)
gpu_idGPU ID for memory allocation (-1 for CPU memory, >=0 for GPU)
Returns
Tensor* Newly created tensor with allocated memory

◆ initGroupOriginTensor()

void initGroupOriginTensor ( TensorCache *  tensorCache,
const std::vector< float > &  group_origin 
)

Initializes group origin tensor using pre-allocated memory and updates the TensorCache.

Parameters
tensorCachePointer to TensorCache object
group_originVector of group origin values

◆ initImageWHTensor()

void initImageWHTensor ( TensorCache *  tensorCache,
int  width,
int  height 
)

Initializes image width/height tensor using pre-allocated memory and updates the TensorCache.

Parameters
tensorCachePointer to TensorCache object
widthWidth of the image
heightHeight of the image

◆ initInputCachedAnchorTensor()

void initInputCachedAnchorTensor ( TensorCache *  tensorCache)

Initializes cached anchor tensor using pre-allocated memory and updates the TensorCache.

Parameters
tensorCachePointer to TensorCache object

◆ initInputCachedFeatureTensor()

void initInputCachedFeatureTensor ( TensorCache *  tensorCache)

Initializes cached feature tensor using pre-allocated memory and updates the TensorCache.

Parameters
tensorCachePointer to TensorCache object

◆ initIntervalMaskTensor()

void initIntervalMaskTensor ( TensorCache *  tensorCache,
float  value 
)

Initializes interval mask tensor using pre-allocated memory and updates the TensorCache.

Parameters
tensorCachePointer to TensorCache object
valueValue for the mask (typically 1.0)

◆ initOrgProjectionMatTensor()

void initOrgProjectionMatTensor ( TensorCache *  tensorCache,
int  batch_size,
int  num_sensors,
const std::vector< Eigen::Matrix< float, 4, 4 >> &  calib_matrices,
int  gpu_id 
)

Initialize projection matrix tensor and update the TensorCache.

Parameters
tensorCachePointer to TensorCache object
batch_sizeSparse4D model batch size
num_sensorsNumber of sensors [Deepstream batch size]
calib_matricesVector of calibration matrices (4x4) to use
gpu_idGPU ID for memory allocation (-1 for CPU memory, >=0 for GPU)

◆ initProjectionMatTensor()

void initProjectionMatTensor ( TensorCache *  tensorCache,
int  batch_size,
int  num_sensors,
const std::vector< Eigen::Matrix< float, 4, 4 >> &  calib_matrices 
)

Initializes projection matrix tensor using pre-allocated memory and updates the TensorCache.

Parameters
tensorCachePointer to TensorCache object
batch_sizeSparse4D model batch size
num_sensorsNumber of sensors [Deepstream batch size]
calib_matricesVector of calibration matrices (4x4) to use

◆ intiPrevExistsTensor()

void intiPrevExistsTensor ( TensorCache *  tensorCache,
float  value 
)

Initializes prev_exists tensor using pre-allocated memory and updates the TensorCache.

Parameters
tensorCachePointer to TensorCache object
valueBoolean value (0.0 = false, non-zero = true)

◆ updateInputCachedAnchorTensor()

void updateInputCachedAnchorTensor ( TensorCache *  tensorCache,
torch::Tensor  anchor 
)

Updates input cached anchor tensor using pre-allocated memory.

Parameters
tensorCachePointer to TensorCache object
anchorAnchor tensor to update

◆ updateInputCachedFeatureTensor()

void updateInputCachedFeatureTensor ( TensorCache *  tensorCache,
torch::Tensor  feature 
)

Updates input cached feature tensor using pre-allocated memory.

Parameters
tensorCachePointer to TensorCache object
featureFeature tensor to update

◆ updateOrgProjectionMatrixForBatch()

void updateOrgProjectionMatrixForBatch ( TensorCache *  tensorCache,
const std::map< std::string, Eigen::Matrix< float, 4, 4 >> &  cameraMatrices,
const std::vector< std::string > &  currentBatchCameras,
int  batch_size,
int  num_sensors 
)

Updates the original projection matrix tensor based on the current camera names in the batch.

Parameters
tensorCachePointer to TensorCache object
cameraMatricesMap of camera names to their projection matrices
currentBatchCamerasVector of current camera names in the batch
batch_sizeSparse4D model batch size
num_sensorsMaximum number of sensors supported by the model

◆ updateProjectionMatrixForBatch()

void updateProjectionMatrixForBatch ( TensorCache *  tensorCache,
const std::map< std::string, Eigen::Matrix< float, 4, 4 >> &  cameraMatrices,
const std::vector< std::string > &  currentBatchCameras,
int  batch_size,
int  num_sensors 
)

Updates projection matrix tensor based on the current camera names in the batch.

Parameters
tensorCachePointer to TensorCache object
cameraMatricesMap of camera names to their projection matrices
currentBatchCamerasVector of current camera names in the batch
batch_sizeSparse4D model batch size
num_sensorsMaximum number of sensors supported by the model