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

オープン
#4,926 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 6 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python, pytorch

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
C++
スター
13.5k
フォーク
2.4k
平均マージ
6日 21時間
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NVIDIA/TensorRT のほかの issue

NVIDIA/TensorRT の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。