NVIDIA-AI-IOT / torch2trt

An easy to use PyTorch to TensorRT converter
MIT License
4.49k stars 670 forks source link

Convert trt_engine to torch2trt model #704

Open vishnuvarreddy opened 2 years ago

vishnuvarreddy commented 2 years ago

With the below code, I connverted torch model to trt_model and serialized to model.engine. Is there a way to get back deserialized model_trt from the model.engine and do inference same as model_trt(x).

`model = alexnet(pretrained=True).eval().cuda() x = torch.ones((10, 3, 224, 224)).cuda()

model_trt = torch2trt(model, [x], max_batch_size=10) with open('model.engine','wb') as f: f.write(model_trt.engine.serialize())`

leaf918 commented 3 weeks ago

no,you cannot do that . TensorRT engine file is blackbox.