Skip to main content

Torch-TensorRT

Easily achieve the best inference performance for any PyTorch model on the NVIDIA platform.

Documentation pytorch cuda trt license Linux x86-64 Nightly Wheels Linux SBSA Nightly Wheels Windows Nightly Wheels


Torch-TensorRT brings the power of TensorRT to PyTorch. Accelerate inference latency by up to 5x compared to eager execution in just one line of code.

Installation

Stable versions of Torch-TensorRT are published on PyPI

pip install torch-tensorrt

Nightly versions of Torch-TensorRT are published on the PyTorch package index

pip install --pre torch-tensorrt --index-url https://download.pytorch.org/whl/nightly/cu134 --extra-index-url https://pypi.org/simple

Torch-TensorRT is also distributed in the ready-to-run NVIDIA NGC PyTorch Container which has all dependencies with the proper versions and example notebooks included.

For more advanced installation methods, please see here

Quickstart

Option 1: torch.compile

You can use Torch-TensorRT anywhere you use torch.compile:

import torch
import torch_tensorrt

model = MyModel().eval().cuda() # define your model here
x = torch.randn((1, 3, 224, 224)).cuda() # define what the inputs to the model will look like

optimized_model = torch.compile(model, backend="tensorrt")
optimized_model(x) # compiled on first run

optimized_model(x) # this will be fast!

Option 2: Export

If you want to optimize your model ahead-of-time and/or deploy in a C++ environment, Torch-TensorRT provides an export-style workflow that serializes an optimized module. This module can be deployed in PyTorch or with libtorch (i.e. without a Python dependency).

Step 1: Optimize + serialize

import torch
import torch_tensorrt

model = MyModel().eval().cuda() # define your model here
inputs = [torch.randn((1, 3, 224, 224)).cuda()] # define a list of representative inputs here

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

Step 2: Deploy

Deployment in PyTorch:
import torch
import torch_tensorrt

inputs = [torch.randn((1, 3, 224, 224)).cuda()] # your inputs go here

# You can run this in a new python session!
model = torch.export.load("trt.ep").module()
# model = torch_tensorrt.load("trt.ep").module() # this also works
model(*inputs)
Deployment in C++:
#include "torch/script.h"
#include "torch_tensorrt/torch_tensorrt.h"

auto trt_mod = torch::jit::load("trt.ts");
auto input_tensor = [...]; // fill this with your inputs
auto results = trt_mod.forward({input_tensor});

Further resources

Platform Support

Platform Support
Linux AMD64 / GPU Supported
Linux SBSA / GPU Supported
Windows / GPU Supported (Dynamo only)
Linux Jetson / GPU Source Compilation Supported on JetPack-4.4+
Linux Jetson / DLA Source Compilation Supported on JetPack-4.4+
Linux ppc64le / GPU Not supported

Note: Refer NVIDIA L4T PyTorch NGC container for PyTorch libraries on JetPack.

Dependencies

These are the following dependencies used to verify the testcases. Torch-TensorRT can work with other versions, but the tests are not guaranteed to pass.

  • Bazel 8.1.1
  • Libtorch 2.15.0.dev (latest nightly)
  • CUDA 13.4
  • TensorRT 11.4.0.106

Deprecation Policy

Deprecation is used to inform developers that some APIs and tools are no longer recommended for use. Beginning with version 2.3, Torch-TensorRT has the following deprecation policy:

Deprecation notices are communicated in the Release Notes. Deprecated API functions will have a statement in the source documenting when they were deprecated. Deprecated methods and classes will issue deprecation warnings at runtime, if they are used. Torch-TensorRT provides a 6-month migration period after the deprecation. APIs and tools continue to work during the migration period. After the migration period ends, APIs and tools are removed in a manner consistent with semantic versioning.

Contributing

Take a look at the CONTRIBUTING.md

License

The Torch-TensorRT license can be found in the LICENSE file. It is licensed with a BSD Style licence

Metadata

Release files for torch-tensorrt-rtx 2.15.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for torch-tensorrt-rtx 2.15.0
File Actions
torch_tensorrt_rtx-2.15.0-1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for torch_tensorrt_rtx-2.15.0-1-cp314-cp314-win_amd64.whl
torch_tensorrt_rtx-2.15.0-1-cp314-cp314-manylinux_2_39_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.39+ ARM64 Details for torch_tensorrt_rtx-2.15.0-1-cp314-cp314-manylinux_2_39_aarch64.whl
torch_tensorrt_rtx-2.15.0-1-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details for torch_tensorrt_rtx-2.15.0-1-cp314-cp314-manylinux_2_28_x86_64.whl
torch_tensorrt_rtx-2.15.0-1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for torch_tensorrt_rtx-2.15.0-1-cp313-cp313-win_amd64.whl
torch_tensorrt_rtx-2.15.0-1-cp313-cp313-manylinux_2_39_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.39+ ARM64 Details for torch_tensorrt_rtx-2.15.0-1-cp313-cp313-manylinux_2_39_aarch64.whl
torch_tensorrt_rtx-2.15.0-1-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for torch_tensorrt_rtx-2.15.0-1-cp313-cp313-manylinux_2_28_x86_64.whl
torch_tensorrt_rtx-2.15.0-1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for torch_tensorrt_rtx-2.15.0-1-cp312-cp312-win_amd64.whl
torch_tensorrt_rtx-2.15.0-1-cp312-cp312-manylinux_2_39_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.39+ ARM64 Details for torch_tensorrt_rtx-2.15.0-1-cp312-cp312-manylinux_2_39_aarch64.whl
torch_tensorrt_rtx-2.15.0-1-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for torch_tensorrt_rtx-2.15.0-1-cp312-cp312-manylinux_2_28_x86_64.whl
torch_tensorrt_rtx-2.15.0-1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for torch_tensorrt_rtx-2.15.0-1-cp311-cp311-win_amd64.whl
torch_tensorrt_rtx-2.15.0-1-cp311-cp311-manylinux_2_39_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.39+ ARM64 Details for torch_tensorrt_rtx-2.15.0-1-cp311-cp311-manylinux_2_39_aarch64.whl
torch_tensorrt_rtx-2.15.0-1-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for torch_tensorrt_rtx-2.15.0-1-cp311-cp311-manylinux_2_28_x86_64.whl

Total release size: 42.5 MB

Release files / torch_tensorrt_rtx-2.15.0-1-cp314-cp314-win_amd64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp314-cp314-win_amd64.whl
Size 2.4 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
fa1aade0991b75876716dcaee5873dae2778db91bc338bfceea8f09c53dc3c27
BLAKE2b-256 checksum
How to use checksums
f48a739768330610132b9fe52ce4debd64ea179395e3fa0dbb231e7868efd05a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / torch_tensorrt_rtx-2.15.0-1-cp314-cp314-manylinux_2_39_aarch64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp314-cp314-manylinux_2_39_aarch64.whl
Size 4.1 MB
Tags CPython 3.14 Linux glibc 2.39+ ARM64
SHA-256 checksum
How to use checksums
ce1da769ba1881b1e3232eace81981c51bb8ba7edd1d27590724a60c9eb05d22
BLAKE2b-256 checksum
How to use checksums
d342470f169c8a77dbd00d573d0d88fb0a3ba1edc06e0c4f65f7bbc74e57aba3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / torch_tensorrt_rtx-2.15.0-1-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp314-cp314-manylinux_2_28_x86_64.whl
Size 4.2 MB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9fbda137bede7ea37b02c10b62f77a33a17cd57cd2774bac871975c869524a4d
BLAKE2b-256 checksum
How to use checksums
c7bb256fb1156244c992121daf1120d61279648ee00a465884d6789b7a147800
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / torch_tensorrt_rtx-2.15.0-1-cp313-cp313-win_amd64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp313-cp313-win_amd64.whl
Size 2.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
d7acc8aa15a81c0e486366255e91e9bbcdc382ad975af42a3159ec05f71890d7
BLAKE2b-256 checksum
How to use checksums
919a2ea4f2dec1a4f4e56b3beaaab7280d9eaf39e7bc745a920c70c01ec3a06d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / torch_tensorrt_rtx-2.15.0-1-cp313-cp313-manylinux_2_39_aarch64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp313-cp313-manylinux_2_39_aarch64.whl
Size 4.1 MB
Tags CPython 3.13 Linux glibc 2.39+ ARM64
SHA-256 checksum
How to use checksums
1e970e6a694cbcdc4519229a31be2d26f874e97f1e5383385901f93e970a0366
BLAKE2b-256 checksum
How to use checksums
3d2ca97c6f982d5d821e5545802059793ae222e454938bc256b63069b1633713
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / torch_tensorrt_rtx-2.15.0-1-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp313-cp313-manylinux_2_28_x86_64.whl
Size 4.2 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
7b642802a34a3b20a0b318de6569c0228c8761866fe9e1bdf70d8ab44d372f06
BLAKE2b-256 checksum
How to use checksums
8e507b5bdb76eee368492062c7b7cedf033b7d45332f3de36c664f888075f1a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / torch_tensorrt_rtx-2.15.0-1-cp312-cp312-win_amd64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp312-cp312-win_amd64.whl
Size 2.4 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
4b1f3ade69713bf38663399e225369fd2a1fb7ee3a6512e85fb5925aa7b2b8ea
BLAKE2b-256 checksum
How to use checksums
24ee207cfdd16214baee72f8a27cfd3fee10e4a2420c70993609e7a4d452ee41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / torch_tensorrt_rtx-2.15.0-1-cp312-cp312-manylinux_2_39_aarch64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp312-cp312-manylinux_2_39_aarch64.whl
Size 4.1 MB
Tags CPython 3.12 Linux glibc 2.39+ ARM64
SHA-256 checksum
How to use checksums
33c934f063b00d1ab04229da322bda7b98865af2627d2fd00a4e2f4b79946597
BLAKE2b-256 checksum
How to use checksums
a3f841c5281be4bfb34ef1e03e26fcd28aef35191956e377a002907a68ff9d04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / torch_tensorrt_rtx-2.15.0-1-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp312-cp312-manylinux_2_28_x86_64.whl
Size 4.2 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9663952ce5720f8db40bb99d8dc5d8e9025ace4108904ffb14a3eb9ecb830f97
BLAKE2b-256 checksum
How to use checksums
66db155ca0f71de7625a7d03d182c4059a16318023dcf9e310ff450e0f927075
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / torch_tensorrt_rtx-2.15.0-1-cp311-cp311-win_amd64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp311-cp311-win_amd64.whl
Size 2.4 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
e0ef60f42a73d933ca96a934e59c95076906fdbebdde5efce295a63dab0eccfd
BLAKE2b-256 checksum
How to use checksums
bb40c51aa99640dc8af4db7783810ceea8d4ca912ce683365c9436ab41fa997a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / torch_tensorrt_rtx-2.15.0-1-cp311-cp311-manylinux_2_39_aarch64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp311-cp311-manylinux_2_39_aarch64.whl
Size 4.1 MB
Tags CPython 3.11 Linux glibc 2.39+ ARM64
SHA-256 checksum
How to use checksums
d251036c94066bfe471c3999a5333cc3983418b2e0532d628d38a291b0bbf284
BLAKE2b-256 checksum
How to use checksums
9b51dadefabec954a06bbdd6262abf1a0f03507314a40ffe01d3e61d778e1261
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / torch_tensorrt_rtx-2.15.0-1-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL torch_tensorrt_rtx-2.15.0-1-cp311-cp311-manylinux_2_28_x86_64.whl
Size 4.2 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4084ee056506e77e86122398e7aff6e3858945ea5abad18bdfc14300427a9cbe
BLAKE2b-256 checksum
How to use checksums
a2efa2ce3a20716e1d56c7bfee58222f5ab3fda97936779b04fb29363fb176ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Security for torch-tensorrt-rtx 2.15.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page