[TensorRT] ERROR: 4: [network.cpp::validate::2749] Error Code 4: Internal Error (step: optimization profile is missing values for shape input)


I’m trying to build engine from a onnx model. The model has some dynamic inputs and I set up the optimization profile accordingly. Besides that, it has a input step.

name: "step"
type {
  tensor_type {
    elem_type: 7
    shape {
      dim {
        dim_value: 1

Then I got this error “[TensorRT] ERROR: 4: [network.cpp::validate::2749] Error Code 4: Internal Error (step: optimization profile is missing values for shape input)”

What does it mean by ‘missing values for shape input’?


TensorRT Version:
GPU Type: 2080Ti
Nvidia Driver Version: 460.80
CUDA Version: 10.2
CUDNN Version: 8.1.1
Operating System + Version: Ubuntu 18.04.4
Python Version (if applicable): 3.8.11
TensorFlow Version (if applicable):
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):

Relevant Files

Please attach or include links to any models, data, files, or scripts necessary to reproduce your issue. (Github repo, Google Drive, Dropbox, etc.)

Steps To Reproduce

Please include:

  • Exact steps/commands to build your repro
  • Exact steps/commands to run your repro
  • Full traceback of errors encountered

Request you to share the ONNX model and the script if not shared already so that we can assist you better.
Alongside you can try few things:

  1. validating your model with the below snippet


import sys
import onnx
filename = yourONNXmodel
model = onnx.load(filename)
2) Try running your model with trtexec command.
In case you are still facing issue, request you to share the trtexec “”–verbose"" log for further debugging

Magically it works with trtexec… but not my Python script. Anyway thank you


Please refer following doc for more details on working with dynamic shape inputs/optimization profile. If you still face this issue, please share us issue repro script/model for better debugging.

Thank you.