[TRT] [E] 2: [graph.cpp::checkDimsSanity::817] Error Code 2: Internal Error (Assertion !never(dims.d[i] >= 0) failed. )

When I use parser to optimize my onnx model, I get a Error
[TRT] [E] 2: [graph.cpp::checkDimsSanity::817] Error Code 2: Internal Error (Assertion !never(dims.d[i] >= 0) failed. )
ONNXToTensorRT (2.2 KB)

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

Size of model is too large

[04/08/2022-03:20:45] [TRT] [V] Parsing node: TopK_1989 [TopK]
[04/08/2022-03:20:45] [TRT] [V] Searching for input: ctc_log_probs
[04/08/2022-03:20:45] [TRT] [V] Searching for input: 3478
[04/08/2022-03:20:45] [TRT] [V] TopK_1989 [TopK] inputs: [ctc_log_probs → (-1, -1, 4233)[FLOAT]], [3478 → (1)[INT32]],
[04/08/2022-03:20:45] [TRT] [V] Registering layer: TopK_1989 for ONNX node: TopK_1989
[04/08/2022-03:20:45] [TRT] [V] Registering tensor: beam_log_probs_17 for ONNX tensor: beam_log_probs
[04/08/2022-03:20:45] [TRT] [V] Registering tensor: beam_log_probs_idx_18 for ONNX tensor: beam_log_probs_idx
[04/08/2022-03:20:45] [TRT] [V] TopK_1989 [TopK] outputs: [beam_log_probs → (-1, -1, 10)[FLOAT]], [beam_log_probs_idx → (-1, -1, 10)[INT32]],
[04/08/2022-03:20:45] [TRT] [V] Marking encoder_out_14 as output: encoder_out
[04/08/2022-03:20:45] [TRT] [V] Marking encoder_out_lens_16 as output: encoder_out_lens
[04/08/2022-03:20:45] [TRT] [V] Marking ctc_log_probs_15 as output: ctc_log_probs
[04/08/2022-03:20:45] [TRT] [V] Marking beam_log_probs_17 as output: beam_log_probs
[04/08/2022-03:20:45] [TRT] [V] Marking beam_log_probs_idx_18 as output: beam_log_probs_idx
[04/08/2022-03:20:45] [TRT] [W] Output type must be INT32 for shape outputs
[04/08/2022-03:20:45] [TRT] [W] Output type must be INT32 for shape outputs
Succeeded parsing encoder.onnx file!
[04/08/2022-03:20:45] [TRT] [V] Applying generic optimizations to the graph for inference.
[04/08/2022-03:20:45] [TRT] [V] Original: 2539 layers
[04/08/2022-03:20:45] [TRT] [V] After dead-layer removal: 2539 layers
[04/08/2022-03:20:45] [TRT] [V] Running: ConstShuffleFusion
[04/08/2022-03:20:45] [TRT] [V] ConstShuffleFusion: Fusing encoder.global_cmvn.mean with (Unnamed Layer* 68) [Shuffle]
[04/08/2022-03:20:45] [TRT] [E] 2: [graph.cpp::checkDimsSanity::817] Error Code 2: Internal Error (Assertion !never(dims.d[i] >= 0) failed. )
[04/08/2022-03:20:45] [TRT] [E] 2: [builder.cpp::buildSerializedNetwork::609] Error Code 2: Internal Error (Assertion enginePtr != nullptr failed. )


Could you please try on the latest TensorRT version 8.4.
If you still face this issue, please share with us an issue repro ONNX model to try from our end for better debugging.

Please share using Google drive.

Thank you.