NVIDIA / NVIDIA/TensorRT

convert onnx to tensorrt failured. INetworkDefinition::addGridsample: Error Code 3: ApI Usage Error

Open
#4,619 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Log

data = torch.ones((1, 1, 512, 32, 32), dtype=torch.float32)
grid = torch.ones((1, 512, 32, 32, 3), dtype=torch.float32).cuda()
res = torch.nn.functional.grid_sample(img, grid)

The ONNX model performs inference correctly, but conversion to TensorRT fails. The error indicates that the GridSample operator does not support 5D input format.

Image

Environment

**Windows 11

TensorRT Version: 10.6.0.26

NVIDIA GPU: 4070TIs

CUDA Version: 12.8

CUDNN Version: 9

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 the Python reproduction in the issue and inspect TensorRT's GridSample support and related conversion path for 5D inputs. Compare the ONNX behavior with TensorRT 10.6.0.26 using the provided environment details; done means the failure is resolved or the unsupported case is clearly documented with a verified result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
ai-infra-agents, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.