NVIDIA / NVIDIA/TensorRT

ICudaEngine.getTensorShape function gets the output dimension of the model that contains -1.

Open
#4,120 38 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

I get ICudaEngine object after model building with TensorRT. And I get output dimension of model by ICudaEngine.getTensorShape.

The output dimension contains -1. Then sometimes there is no -1, but the correct dimension value.

What determines the value of the output dimension, and under what circumstances is there a -1 in the output dimension.

This is my onnx model info:

$ polygraphy inspect model codetr_op17_sim.onnx
[I] ==== ONNX Model ====
    Name: torch_jit | ONNX Opset: 17
    
    ---- 1 Graph Input(s) ----
    {input [dtype=float32, shape=(1, 3, 832, 1440)]}
    
    ---- 1 Graph Output(s) ----
    {output [dtype=float32, shape=(1, 1000, 6)]}
    
    ---- 881 Initializer(s) ----
    
    ---- 3581 Node(s) ----

But getTensorShape gets an output dimension of [1, -1, 6]

Environment

TensorRT Version: tensorrt10.3

NVIDIA GPU: RTX 3090

NVIDIA Driver Version: 535.183.01

CUDA Version: 12.2

Operating System: ubuntu22.04

PyTorch Version (if applicable): 1.13.0

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 reported ICudaEngine.getTensorShape call and compare it with the output from polygraphy inspect model codetr_op17_sim.onnx. Review the TensorRT engine-building context and the model's dynamic-shape handling; done means documenting the conditions that produce -1 and confirming them with a minimal reproduction.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.