Skip to content

Commit 1cf6485

Browse files
committed
C++ deployment
1 parent 32a23a6 commit 1cf6485

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ model = MyModel().eval().cuda() # define your model here
6262
inputs = [torch.randn((1, 3, 224, 224)).cuda()] # define a list of relevant inputs here
6363

6464
trt_gm = torch_tensorrt.compile(model, ir="dynamo", inputs)
65-
torchtrt.save(trt_gm, "trt.ep", inputs=inputs)
65+
torch_tensorrt.save(trt_gm, "trt.ep", inputs=inputs) # PyTorch only supports Python runtime for an ExportedProgram. For C++ deployment, use a TorchScript file
66+
torch_tensorrt.save(trt_gm, "trt.ts", output_format="torchscript", inputs=inputs)
6667
```
6768

6869
#### Step 2: Deploy
@@ -84,7 +85,9 @@ model(*inputs)
8485
#include "torch/script.h"
8586
#include "torch_tensorrt/torch_tensorrt.h"
8687

87-
// to fill
88+
auto trt_mod = torch::jit::load("trt.ts");
89+
auto input_tensor = [...]; // fill this with your inputs
90+
auto results = trt_mod.forward({input_tensor});
8891
```
8992
9093
## Further resources

0 commit comments

Comments
 (0)