All named dimensions that share the same name must be equal


A clear and concise description of the bug or issue.


TensorRT Version: 8.2
GPU Type: T4
Nvidia Driver Version: 470
CUDA Version: 11.4
I have an error report when onnx model is converted to TRT.
model:This is a transformer model for language recognition

./tensorrt/bin/trtexec --explicitBatch --minShapes=speech:1x16x80 --optShapes=speech:4x256x80 --maxShapes=speech:16x256x80 --onnx=encoder_change.onnx --saveEngine=encoder.plan --workspace=28012

Error[4]: [graphShapeAnalyzer.cpp::processCheck::581] Error Code 4: Internal Error (IAssertionLayer (Unnamed Layer* 5) [Assertion]: condition[0] is false: 0. For input: 'speech' all named dimensions that share the same name must be equal. Note: Named dimensions were present on the following axes: 0 (name: 'B'), 0 (name: 'B'))

What does this error mean?

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

How to upload files over 100MB?
I found that only when the batch size of minshapes is greater than 1, there will be an error, otherwise it will be normal.
not work

./tensorrt/bin/trtexec --explicitBatch --minShapes=speech:4x16x80 --optShapes=speech:4x256x80 --maxShapes=speech:16x256x80 --onnx=encoder_change.onnx --saveEngine=encoder.plan --workspace=28012 --verbose


./tensorrt/bin/trtexec --explicitBatch --minShapes=speech:1x16x80 --optShapes=speech:4x256x80 --maxShapes=speech:16x256x80 --onnx=encoder_change.onnx --saveEngine=encoder.plan --workspace=28012 --verbose

Verbose does not display any more valid information

The problem has been solved. I set one less input shape

Hello @549981178,
I have the same problem.
I have a model with 4 inputs and I’m getting the error for one of them and I don’t have any clue what is the root problem cause.

Can you clarify please, in your case, exactly what did you understand about the problem root cause and what did you change in order to solve it?


All input dimensions need to be specified.

trtexec --explicitBatch --plugins=./ --minShapes=speech:1x16x80,speech_lengths:1 --optShapes=speech:4x256x80,speech_lengths:4 --maxShapes=speech:16x256x80,speech_lengths:16 --onnx=encoder_change.onnx --saveEngine=encoder.plan --workspace=18012 --fp16