Reading engine file generated by trtexec failed in vs2019


in vs2019,reading engine file failed


TensorRT Version: v8.2.3.0cuda11.4cudnn8.2
GPU Type: RTX3060
Nvidia Driver Version: 462.36
CUDA Version: 11.2
CUDNN Version: 8.2
Operating System + Version: Win10
Python Version (if applicable): 3.8
TensorFlow Version (if applicable):
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):

Relevant Files

Please attach or include links to any models, data, files, or scripts necessary to reproduce your issue. (Github repo, Google Drive, Dropbox, etc.)
lanenet.engine (9.6 MB)

Steps To Reproduce

step 1 ;
D:\Program\TensorRT\v8.2.3.0cuda11.4cudnn8.2\bin\trtexec.exe --onnx=lanenet.onnx --saveEngine=lanenet.engine --verbose

step 2:
in visual studio 2019,read the engine file to infer
std::string engine_filepath = “lanenet.engine”;
std::ifstream file;, std::ios::binary | std::ios::in);
file.seekg(0, std::ios::end);
int length = file.tellg();
file.seekg(0, std::ios::beg);

the engine file put with the .exe, the length return -1, why?

Please include:

  • Exact steps/commands to build your repro
  • Exact steps/commands to run your repro
  • Full traceback of errors encountered


Please refer following doc for deserializing TRT engine file.

Thank you.

I found the mistake, the path of engine file is not recognized by vs2019

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.