#2706·nnUNet

TensorRT deployment

Author: davidkflauCreated Feb 18, 2025Updated Sep 23, 2026

Hi,

I'm trying to optimize the inference speed by converting the model to tensorRT using pytorch-tensorrt. I added below code to the predict_sliding_window_return_logits and saved the tensorRT model, but the inference speed of the tensorRT model is 10x slower than the pytorch model. Does anyone know how to convert the model to tensorRT properly?

input = torch.randn((1, 5, 20, 320, 256)).cuda() trt_gm = torch_tensorrt.compile(self.network, ir="dynamo", inputs=[input], backend="torch_tensorrt", dynamic=False, options={"truncate_long_and_double": True, "enabled_precisions": {torch.float,torch.half}, "debug": False, "optimization_level": 5})

torch_tensorrt.save(trt_gm, "model.ep", inputs=[input])