TensorRT and CUDA bindings for C# and .NET, with managed APIs, project-owned bridge packages, runnable vision samples, and a TensorRtExec desktop workflow.
English | 简体中文
TensorRtSharp4.0 provides a .NET API for TensorRT inference, CUDA runtime compilation, memory, streams, callbacks, and the TensorRtExec desktop workflow. The first 4-series preview is published; development now focuses on package-consuming examples, applications, and complete technical articles.
The managed API keeps the public namespace roots stable:
JYPPX.TensorRtSharpis the main TensorRT surface and the default home for shared types.JYPPX.CudaSharpis the CUDA surface.- Native bridge loading is explicit through
jyppxtrtbridgeand the versioned bridge package.
CUDA, cuDNN, TensorRT, and NVRTC are user-installed prerequisites. NVIDIA runtime redistribution is retired: this repository publishes managed source/packages and project-owned bridge-only packages, never CUDA/cuDNN/TensorRT vendor archives.
- C# bindings and source are grouped by module under
src. - TensorRT engine building, execution contexts, bindings, dynamic-shape profiles, allocators, logging, profiling, progress monitoring, streams, events, CUDA graphs, and CUDA RTC are covered by the managed API.
- Runtime package roles are explicit: the
.Bridgepackages withsplit_package_roles=bridgecontain only the project bridge for a fixed CUDA/TensorRT line. - NuGet branding is fixed:
nuget/logo.jpgis the package logo and the English root README is embedded as the package README. - The release license is Apache-2.0.
- Establishes the stable
JYPPX.TensorRtSharpandJYPPX.CudaSharpnamespace roots and the first preview managed API surface. - Provides the managed package plus versioned Windows/Linux bridge-only packages; consumers install the matching NVIDIA runtime themselves.
- Adds reproducible sample model acquisition and ONNX conversion records while keeping model binaries outside Git.
Read the detailed 4.0.0-preview.1 notes or browse the complete version index.
Create a console project, reference the managed package, and install the bridge package that matches the CUDA/TensorRT installation on the target machine:
dotnet new console -n TrtQuickstart
cd TrtQuickstart
dotnet add package JYPPX.TensorRT.CSharp.API --version "4.0.0-*"
dotnet add package JYPPX.TensorRT.CSharp.API.Runtime.win-x64.trt10.11.cuda12.9.cudnn9.22.Bridge --version "4.0.0-*"The 4.0.0-* rule follows the maintained preview line without selecting API-incompatible historical 4.x packages such as 4.0.6170. Replace the Bridge package ID with the RID and NVIDIA-runtime matrix installed on the target machine.
Then create a runtime, load an engine, bind input/output tensors, execute, and read the result. The bridge package is not a replacement for the user-installed NVIDIA runtime. See the inference bindings tutorial and Windows installation guide.
| Package | Contents |
|---|---|
JYPPX.TensorRT.CSharp.API |
Managed TensorRT and CUDA-facing C# API |
JYPPX.TensorRT.CSharp.API.Bridge.* |
Project-owned native bridge only, selected by installed CUDA/TensorRT versions |
Classification at samples/ComputerVision/01.Classification and YoloVision at applications/YoloVision are runnable examples. They consume the public 4-series managed package and are deliberately excluded from all public package feeds and Release assets.
| Series | Project | Focus |
|---|---|---|
| CUDA | Cuda/01.RuntimeCompilation |
CUDA RTC compilation, module loading, launch, and readback |
| Inference | Inference/01.Bindings, Inference/02.DynamicShapes |
Bindings, memory ownership, and dynamic profiles |
| Performance | Performance/01.MultiStream |
CUDA streams, events, and ordering |
| Computer vision | Classification |
Image preprocessing, Top-K output, JSON, and annotated results |
| Applications | YoloVision, OnnxToEngine, TensorRtExec |
Complete multi-step workflows and advanced usage |
See the sample series and applications for runnable commands and matching articles.
CUDA RTC roadmap: English | 简体中文 | technical article
The first public 4-series preview is available. Package README content is the English root README, package branding uses nuget/logo.jpg, and the core managed package uses the Apache-2.0 SPDX license expression.
| Package | Version | NuGet.org | GitHub Packages | Purpose |
|---|---|---|---|---|
JYPPX.TensorRT.CSharp.API |
Gallery | Package feed | Core managed TensorRT/CUDA API |
| Release channel | Link | Assets |
|---|---|---|
| GitHub Release | TensorRtSharp4.0 releases | Source archive, core managed .nupkg, and project-owned Bridge .nupkg files |
| GitHub Packages | NuGet package feed | Core managed package and the published project-owned Bridge matrix |
| NuGet.org | NuGet gallery | Core managed package; Bridge packages appear here after their official publication completes |
Every modeled bridge package is listed below. CUDA, cuDNN, and TensorRT are prerequisites installed by the consumer; the .Bridge package contains only jyppxtrtbridge. The Version column is a live NuGet.org badge. published-preview.1 means the package is available in GitHub Packages, the GitHub Release, and NuGet.org.
Runtime packages do not bundle NVIDIA libraries. For local source builds, use the scripts in eng only through the documented entry points; most exporter and owner-proof scripts are internal engineering tools.
Install the matching NVIDIA stack before running a bridge package:
| Example line | Expected user installation |
|---|---|
| Windows x64 TRT 10.11 / CUDA 12.9 | TensorRT 10.11, CUDA 12.9, cuDNN 9.22 |
| Linux x64 TRT 11.0 / CUDA 13.2 | TensorRT 11.0, CUDA 13.2, cuDNN 9.22 |
Use TENSORRT_PATH, JYPPX_TENSORRT_ROOT, and the platform loader path appropriate for your machine. The repository does not upload or package these vendor runtimes.
Demo models are staged outside Git in the sibling models directory and are not included in source archives or packages. Each article records the official acquisition URL, pinned revision, license, conversion command, input/output contract, and SHA256.
| Demo | Official source and conversion |
|---|---|
| MNIST | Project-generated digits; export with the sample PyTorch/ONNX script, then build a TensorRT engine with trtexec. |
| ResNet18 | torchvision official weights; export with torch.onnx.export using NCHW 224x224 and ImageNet normalization. |
| YOLOv8n detection/classification/segmentation/pose/OBB | Ultralytics official checkpoints; export with the pinned Ultralytics command and validate output names/shapes before TensorRT build. |
| YOLOv10n | THU-MIG official checkpoint; export with the repository reference script and preserve end-to-end output contract. |
| YOLOX-S | Megvii official checkpoint; export through the pinned YOLOX/ONNX path and validate decode metadata. |
| LRASPP MobileNetV3 Large | torchvision v0.25.0 official weights; export to [1,21,320,320] with ImageNet mean/std and compare argmax maps. |
See the demo model inventory, acquisition and conversion guide, and eng/Sync-DemoOnnxModels.ps1. Model files stay in the external model store until ModelZoo is available.
- English documentation
- Chinese article catalog and publication criteria
- Project overview
- Source organization
- Model acquisition and ONNX conversion
- Inference bindings
- TensorRtExec GUI
- Release candidate gate
- Release proof and post-publish verification
- Owner input cross-hash audit
- TensorRtExec report boundary
- ONNX to engine report boundary
- YOLOVision asset evidence guide
- Callback/allocator safety gates
- API readiness audit
- YOLOVision model matrix
- TensorRtExec feature matrix
- ONNX-to-engine parity matrix
- Article roadmap 30-plus
dotnet restore TensorRtSharp.sln
dotnet build TensorRtSharp.sln -c Release
dotnet test tests/JYPPX.ProjectQuality.Tests/JYPPX.ProjectQuality.Tests.csproj -c Release --no-restoreFor a future release, set JYPPXPackageVersion to the approved 4-series version. Inspect every generated nupkg before upload; it must contain the package README and logo.jpg and must not contain CUDA, cuDNN, or TensorRT vendor binaries.
Workflows are manual-only to conserve Actions quota. The grape-yan repository is validation-only and never publishes. Run local restore, build, focused tests, package inspection, and clean-consumer checks first; dispatch a remote validation or formal release only after the Owner approves it.
NuGet publication requires the core package permission plus package-scoped push permission for each project-owned .Bridge ID. JYPPX.TensorRT.CSharp.API.YoloVision and JYPPX.TensorRT.CSharp.API.Classification are sample-only IDs and must never be uploaded. A nuget.org 403 is an authorization failure, not a retryable build failure.
src: managed interfaces grouped by CUDA, TensorRT, runtime, memory, and shared modules.native: project bridge source and ABI exports.samples: runnable C# demonstrations and model metadata.applications/TensorRtExec: desktop engine builder and runner.pack: managed and bridge-only package definitions.docs: DocFX site and technical articles.eng: build, acquisition, validation, and release engineering scripts.
Licensed under Apache-2.0. See LICENSE.
Please include the package version, CUDA/cuDNN/TensorRT versions, GPU model, operating system, and the failing command when opening an issue. Do not upload proprietary model weights or NVIDIA runtime archives.