OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Infrastructure & Serving

Torch-TensorRT

Torch-TensorRT is an open-source compiler framework that optimizes PyTorch models for inference with NVIDIA TensorRT on NVIDIA GPUs.

Independent OpenViST project profile, based on linked sources.

Torch-TensorRT — OpenViST project profile in AI Infrastructure & Serving.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when an existing PyTorch inference workflow needs a TensorRT compilation path on NVIDIA GPUs, either at runtime or through an exported artifact.

Who it is for

  • PyTorch developers seeking TensorRT-optimized GPU inference.
  • Teams preparing optimized model artifacts for PyTorch or libtorch-based C++ deployment.

Documented uses

  • Compile a PyTorch model at runtime through the torch.compile TensorRT backend.
  • Optimize a model ahead of time using representative inputs and serialize it.
  • Load an exported optimized module in PyTorch or deploy a TorchScript file with libtorch.
Before you choose

Requirements & limits

The project documents stable installation through PyPI, nightly packages through the PyTorch package index, and distribution in an NVIDIA NGC PyTorch container. It is licensed under BSD-3-Clause.

  • The documented inference path targets NVIDIA GPUs and uses CUDA, TensorRT, and PyTorch.
  • Runtime compilation uses torch.compile and compiles on the first model invocation in the example.
  • Ahead-of-time export requires representative inputs; TorchScript is the documented format for C++ deployment.
  • The README also identifies an NGC PyTorch container with dependencies and example notebooks.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Compile a PyTorch model at runtime with torch.compile

Use the TensorRT backend with an evaluation-mode PyTorch model and invoke it on a CUDA input.

Before you start

  • A PyTorch model and input tensor
  • CUDA-capable NVIDIA GPU
  • Torch-TensorRT installed in the PyTorch environment

Steps

  1. Put the model in evaluation mode and move it to CUDA.

  2. Create the input tensor on CUDA.

  3. Call torch.compile(model, backend="tensorrt") to create the optimized model.

  4. Invoke the optimized model with the input; the documented example compiles on the first run.

Expected outcome

A model routed through the TensorRT backend and callable from the PyTorch application.

Guide limitations

  • The example uses a CUDA model and input on an NVIDIA GPU.
  • The documented example does not specify model-specific compatibility or performance results.
Source-based practical guide

Export an optimized module for PyTorch or C++ deployment

Compile a model with representative inputs, serialize it, then load the appropriate exported format in PyTorch or libtorch.

Before you start

  • A PyTorch model in evaluation mode
  • Representative CUDA input tensors
  • Torch-TensorRT and the relevant PyTorch or libtorch runtime

Steps

  1. Compile the model with torch_tensorrt.compile using ir="dynamo" and representative inputs.

  2. Save an ExportedProgram file for PyTorch use, or save with output_format="torchscript" for C++ deployment.

  3. For PyTorch, load the ExportedProgram and call the loaded module with inputs.

  4. For C++, load the TorchScript file with torch::jit::load and call forward with input tensors.

Expected outcome

A serialized optimized module that can be loaded in PyTorch, or a TorchScript module intended for libtorch-based C++ deployment.

Guide limitations

  • The README notes that PyTorch supports Python runtime for an ExportedProgram; use TorchScript for C++ deployment.
  • The provided examples assume CUDA inputs and do not establish compatibility for every model or target environment.
COMPARE OPTIONS

Compare options for Model inference and serving

These projects document a common task and share a project role. This is a source-based comparison, not an execution benchmark or a guarantee of interchangeability.

ProjectDocumented purposePlatformAccess and requirements
Torch-TensorRTCompile a PyTorch model at runtime through the torch.compile TensorRT backend.Linux, macOS, Server, WindowsThe project documents stable installation through PyPI, nightly packages through the PyTorch package index, and distribution in an NVIDIA NGC PyTorch container. It is licensed under BSD-3-Clause.
Cloud AI SDKAdapt and run documented model recipes for computer-vision and NLP inference.Cloud, ServerThe GitHub repository is public. Its public visibility does not establish license terms.
TurboquantReplace a model’s existing inference cache with a compressed cache.Cloud, Linux, macOS, Self-hostedThe project describes itself as open source. The README documents installation through pip or from a source checkout.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
10 October 2026
Original website title
pytorch/TensorRT · Official homepage title · retained in its source language