TensorRT inference engine class.
This class handles the deserialization of TensorRT engines and running inference.
Definition at line 39 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
Public Member Functions | |
| TensorRTEngine () | |
| Constructor. More... | |
| ~TensorRTEngine () | |
| Destructor - frees allocated resources. More... | |
| bool | isInitialized () const |
| Check if the engine is initialized. More... | |
| void | configure (const ConfigProperties &config) |
| Configure the TensorRT engine with properties from config. More... | |
| int | getGpuId () const |
| Get the GPU ID used for inference. More... | |
| nvinfer1::ICudaEngine * | getEngine () const |
| Get the TensorRT engine object. More... | |
| cudaStream_t | getCudaStream () const |
| Get CUDA stream. More... | |
| int | getTensorBindingIndex (const std::string &name) const |
| Get binding index for a tensor by name. More... | |
| nvinfer1::Dims | getBindingDimensions (int index) const |
| Get binding dimensions for a tensor by index. More... | |
| void * | getDeviceBuffer (const std::string &name) const |
| Get device buffer for a tensor by name. More... | |
| std::vector< std::string > | getInputTensorNames () const |
| Get all input tensor names. More... | |
| std::vector< std::string > | getOutputTensorNames () const |
| Get all output tensor names. More... | |
| bool | updateBindingPointer (const std::string &tensorName, void *newBuffer) |
| Updates the binding pointer for a specific tensor. More... | |
| bool | deserializeEngine (const std::string &engineFilePath, TensorCache *tensorCache, int batchSize, int numSensors, PrettyLogger *logger=nullptr) |
| Deserialize a TensorRT engine from a file. More... | |
| bool | runInference (int batch_size, int num_sensors, PrettyLogger *logger=nullptr) |
| Run inference using pre-allocated output tensors. More... | |
| TensorRTEngine () | |
| Constructor. More... | |
| ~TensorRTEngine () | |
| Destructor - frees allocated resources. More... | |
| bool | isInitialized () const |
| Check if the engine is initialized. More... | |
| void | configure (const ConfigProperties &config) |
| Configure the TensorRT engine with properties from config. More... | |
| int | getGpuId () const |
| Get the GPU ID used for inference. More... | |
| nvinfer1::ICudaEngine * | getEngine () const |
| Get the TensorRT engine object. More... | |
| cudaStream_t | getCudaStream () const |
| Get CUDA stream. More... | |
| int | getTensorBindingIndex (const std::string &name) const |
| Get binding index for a tensor by name. More... | |
| nvinfer1::Dims | getBindingDimensions (int index) const |
| Get binding dimensions for a tensor by index. More... | |
| void * | getDeviceBuffer (const std::string &name) const |
| Get device buffer for a tensor by name. More... | |
| std::vector< std::string > | getInputTensorNames () const |
| Get all input tensor names. More... | |
| std::vector< std::string > | getOutputTensorNames () const |
| Get all output tensor names. More... | |
| bool | updateBindingPointer (const std::string &tensorName, void *newBuffer) |
| Updates the binding pointer for a specific tensor. More... | |
| bool | deserializeEngine (const std::string &engineFilePath, TensorCache *tensorCache, int batchSize, int numSensors, PrettyLogger *logger=nullptr) |
| Deserialize a TensorRT engine from a file. More... | |
| bool | runInference (int batch_size, int num_sensors, PrettyLogger *logger=nullptr) |
| Run inference using pre-allocated output tensors. More... | |
| TensorRTEngine::TensorRTEngine | ( | ) |
Constructor.
| TensorRTEngine::~TensorRTEngine | ( | ) |
Destructor - frees allocated resources.
| TensorRTEngine::TensorRTEngine | ( | ) |
Constructor.
| TensorRTEngine::~TensorRTEngine | ( | ) |
Destructor - frees allocated resources.
|
inline |
Configure the TensorRT engine with properties from config.
| config | Configuration properties containing GPU ID, logger severity, and profiler settings |
Definition at line 63 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
References ConfigProperties::enable_profiler, ConfigProperties::gpu_id, and ConfigProperties::trt_logger_severity.
|
inline |
Configure the TensorRT engine with properties from config.
| config | Configuration properties containing GPU ID, logger severity, and profiler settings |
Definition at line 63 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
References ConfigProperties::enable_profiler, ConfigProperties::gpu_id, and ConfigProperties::trt_logger_severity.
| bool TensorRTEngine::deserializeEngine | ( | const std::string & | engineFilePath, |
| TensorCache * | tensorCache, | ||
| int | batchSize, | ||
| int | numSensors, | ||
| PrettyLogger * | logger = nullptr |
||
| ) |
Deserialize a TensorRT engine from a file.
| engineFilePath | Path to the serialized engine file |
| tensorCache | Tensor cache to store tensors |
| batchSize | Sparse4D model batch size |
| numSensors | Number of sensors [Deepstream batch size |
| logger | Optional logger for detailed status messages |
| bool TensorRTEngine::deserializeEngine | ( | const std::string & | engineFilePath, |
| TensorCache * | tensorCache, | ||
| int | batchSize, | ||
| int | numSensors, | ||
| PrettyLogger * | logger = nullptr |
||
| ) |
Deserialize a TensorRT engine from a file.
| engineFilePath | Path to the serialized engine file |
| tensorCache | Tensor cache to store tensors |
| batchSize | Sparse4D model batch size |
| numSensors | Number of sensors [Deepstream batch size |
| logger | Optional logger for detailed status messages |
|
inline |
Get binding dimensions for a tensor by index.
| index | Binding index |
Definition at line 115 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get binding dimensions for a tensor by index.
| index | Binding index |
Definition at line 115 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get CUDA stream.
Definition at line 88 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get CUDA stream.
Definition at line 88 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get device buffer for a tensor by name.
| name | Tensor name |
Definition at line 130 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
References getTensorBindingIndex().
|
inline |
Get device buffer for a tensor by name.
| name | Tensor name |
Definition at line 130 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
References getTensorBindingIndex().
|
inline |
Get the TensorRT engine object.
Definition at line 81 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get the TensorRT engine object.
Definition at line 81 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get the GPU ID used for inference.
Definition at line 74 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get the GPU ID used for inference.
Definition at line 74 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get all input tensor names.
Definition at line 143 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get all input tensor names.
Definition at line 143 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get all output tensor names.
Definition at line 176 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get all output tensor names.
Definition at line 176 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get binding index for a tensor by name.
| name | Tensor name |
Definition at line 96 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Get binding index for a tensor by name.
| name | Tensor name |
Definition at line 96 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
Referenced by getDeviceBuffer(), and updateBindingPointer().
|
inline |
Check if the engine is initialized.
Definition at line 56 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
|
inline |
Check if the engine is initialized.
Definition at line 56 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
| bool TensorRTEngine::runInference | ( | int | batch_size, |
| int | num_sensors, | ||
| PrettyLogger * | logger = nullptr |
||
| ) |
Run inference using pre-allocated output tensors.
| batch_size | Sparse4D model batch size |
| num_sensors | Number of cameras (for dynamic tensor dimensions) |
| logger | Optional logger for detailed status messages |
| bool TensorRTEngine::runInference | ( | int | batch_size, |
| int | num_sensors, | ||
| PrettyLogger * | logger = nullptr |
||
| ) |
Run inference using pre-allocated output tensors.
| batch_size | Sparse4D model batch size |
| num_sensors | Number of cameras (for dynamic tensor dimensions) |
| logger | Optional logger for detailed status messages |
|
inline |
Updates the binding pointer for a specific tensor.
Instead of copying tensor data, this method directly updates the binding pointer to use an external buffer. The external buffer must be in GPU memory with the same size as the original tensor.
| tensorName | The name of the tensor to update |
| newBuffer | Pointer to the new buffer in GPU memory |
Definition at line 215 of file 9.2/sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
References getTensorBindingIndex().
|
inline |
Updates the binding pointer for a specific tensor.
Instead of copying tensor data, this method directly updates the binding pointer to use an external buffer. The external buffer must be in GPU memory with the same size as the original tensor.
| tensorName | The name of the tensor to update |
| newBuffer | Pointer to the new buffer in GPU memory |
Definition at line 215 of file sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/infer/tensor_rt_engine.h.
References getTensorBindingIndex().