Strongly typed engine returns NaN for every depth output on sm_120 (TRT 11.4); onnxruntime on the same ONNX matches PyTorch

Aperta
#4,926 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python, pytorch

Direzione di ricerca

Start by requesting the shareable random-weight ONNX export and input/output NPZ, then run the supplied strongly typed TensorRT reproduction and compare its outputs with ONNX Runtime. Use the reported intermediate-tensor output experiment to narrow the faulty fused region; the issue names no source files or tests to start from. Done means TensorRT produces finite depth and sky outputs consistent with ONNX Runtime and PyTorch.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Module:ONNX

Description

A strongly typed engine built from an ONNX export of MVSAnywhere (multi-view depth: reference image, source images, intrinsics and poses; 448x672, fixed shapes) builds without warnings in 140 s but returns NaN for every element of its depth and sky outputs. onnxruntime 1.32.0 (CPU) on the same file matches PyTorch eager (max abs error 0.010 on depths in 0.27..0.31). The fp32 export behaves the same way (all NaN).

TensorRT:

build: ok in 140 s
output depth (1, 448, 672) float32: nan fraction 1.000
output mask (1, 448, 672) bool: all 0
output sky (1, 448, 672) float32: nan fraction 1.000
output depth_range (1, 2) float32: -0.0825, 0.6475

onnxruntime, same file and inputs:

depth (1, 448, 672): nan fraction 0.000, range 0.271..0.315
mask: all 1
sky: range 1.2e-07..0.075
depth_range: 0.259, 0.630

depth_range shows where it goes wrong: TensorRT returns a negative minimum depth, and the log / sqrt of that range downstream turns the depth map into NaN. The coarse first-stage depth inside the engine is 0.998 everywhere instead of 0.30..0.53. With about 60 intermediate tensors marked as network outputs the engine is finite and correct; with 4 of them it is NaN again, so the problem is in a fused region, not a single op.

The same happens with the weights replaced by random values (seed 0): TensorRT again returns depth_range -0.0825, 0.649 and NaN depths, onnxruntime 0.340, 0.567 and finite depths matching eager. So the wrong value does not depend on the weights, and that random-weight file can be shared freely.

Environment

TensorRT 11.4.0.106 (tensorrt-cu13 wheel, current release), RTX 5060 Ti 16 GB (sm_120), driver 595.99.02, CUDA 13.0, Ubuntu 26.04, Python 3.12. ONNX: torch 2.14.1 dynamo exporter, opset 18, fp16 weights, onnx 1.23.2.

Relevant Files

The ONNX file is 407 MB, above the attachment limit; I can share the random-weight export plus the input/output npz on request (or via a link if you tell me where).

Steps To Reproduce

import tensorrt as trt
logger = trt.Logger(trt.Logger.WARNING)
builder = trt.Builder(logger)
network = builder.create_network(1 << int(trt.NetworkDefinitionCreationFlag.STRONGLY_TYPED))
parser = trt.OnnxParser(network, logger)
assert parser.parse_from_file("mvsanywhere_448x672_fp16.onnx")
plan = builder.build_serialized_network(network, builder.create_builder_config())
# deserialize, bind the npz inputs, execute_async_v3: depth and sky are all NaN

Expected: finite depths, as onnxruntime and PyTorch give. Actual: NaN everywhere, no builder warning.

Lingua principale
C++
Stelle
13.5k
Fork
2.4k
Merge medio
6g 21h
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NVIDIA/TensorRT

Tutte le issue di NVIDIA/TensorRT

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.