NVIDIA / NVIDIA/TensorRT

Accuracy problem between onnx and fp16 trt inference

Open
#4,492 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Module:Accuracy triaged
Dominant language
C++
Stars
13.4k
Forks
2.4k
Avg merge
5d 3h
Merged PRs (30d)
2

Description

Description

I am encountering an accuracy discrepancy between ONNX inference and TensorRT FP32 inference.

Environment

TensorRT Version: 10.8.0.43

NVIDIA GPU: RTX 3060

NVIDIA Driver Version: 560.35.05

CUDA Version: 12.4.99

CUDNN Version: 9.8.0.87

Operating System: 24.04.1-Ubuntu

Python Version (if applicable): 3.11.11

PyTorch Version (if applicable): 2.6.0

Relevant Files

Model link:

https://drive.google.com/drive/folders/1OaczMFXSv2a46QZHwSsn6lT8V3S_Ki-O?usp=sharing

Steps To Reproduce

polygraphy run --onnxrt tlr_202506151003.onnx \
    --data-loader-script tool/data_loader.py \
    --save-outputs outputs_fp32.json

trtexec --onnx=tlr_202506151003.onnx --saveEngine=model_fp32.plan

polygraphy run --trt model_fp32.plan \
    --data-loader-script tool/data_loader.py \
    --load-outputs outputs_fp32.json \
    --atol 0.01 --rtol 0.01

Have you tried the latest release?: not yet

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tool/data_loader.py and reproduce the ONNX Runtime and TensorRT commands in the issue using the linked model and listed environment. Compare the saved outputs and document the exact mismatch, including whether it occurs with FP32 or FP16; the issue is ready for follow-up when the discrepancy is reproducible and its scope is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.