How to suppress TensorRT-related warning messages?

Hi!

When I run the code, TensorRT-related warning messages appear.

[11/14/2023-16:54:39] [TRT] [W] The enqueue() method has been deprecated when used with engines built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. Please use enqueueV2() instead.
[11/14/2023-16:54:39] [TRT] [W] Also, the batchSize argument passed into this function has no effect on changing the input shapes. Please use setBindingDimensions() function to change input shapes instead.

These warning messages affect the output of certain results I want to see.

I would like to know how to prevent these warning messages from appearing when I run the code.

Thanks!

Hi @rd3.pesi ,
You can modify the ProfileVerbosity level to remove warning messages. Please refer to the following doc.
https://docs.nvidia.com/deeplearning/tensorrt/api/c_api/classnvinfer1_1_1_i_logger.html

Also how a parameter impacts the output can be understood from the api ref document, for e.g., the role of enqueueV2() can be understood from here.
Thanks

Hi @AakankshaS

I should make these modifications in which location?
Do I need to modify specific files, or should I add them to my code?

Thanks.

Hello @AakankshaS ,

Can you provide an answer for me?
Thank you

Not sure if you’ve seen the message.
If you have, could you please help respond?

Thanks

Hi @rd3.pesi ,
You should add the flags in your code.
Thanks

Hi @rd3.pesi ,

In case it is useful, you can create your own struct that inherits from the nvinfer1::ILogger class, and override the log method:
void log(Severity severity, const nvinfer1::AsciiChar* msg) noexcept override

and you could temporarily leave it empty or instead of printing to stdout you could redirect the prints to a log, that way no unwanted messages will appear.

And to use the custom struct, create an instance and pass it to the nvinfer1::createInferRuntime(custom_logger) function when initializing.

Regards,
Luis
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com