False (?) dynamic shape error during onnx->trt conversion

Description

Conversion of an onnx model to TRT fails with an error about dynamic shape

Environment

TensorRT Version: 10.0.1
GPU Type: 4090
Nvidia Driver Version: 550
CUDA Version: 12.4
CUDNN Version: 9
Operating System + Version: Ubuntu 24.04
Python Version (if applicable): 3.12
TensorFlow Version (if applicable):
PyTorch Version (if applicable): N/A
Baremetal or Container (if container which image + tag):

Relevant Files

N/A

Steps To Reproduce

curl -LO https://github.com/onnx/models/raw/main/Computer_Vision/maskrcnn_resnet50_fpn_v2_Opset18_torchvision/maskrcnn_resnet50_fpn_v2_Opset18.onnx
trtexec --onnx=maskrcnn_resnet50_fpn_v2_Opset18.onnx --saveEngine=model.trt

While converting an onnx model (MaskRCNN from torchvision), TRT complains about dynamic shape in a place that seems to have a static shape…
The log is as follows:

[05/07/2024-14:28:14] [I] [TRT] Input filename:   maskrcnn_resnet50_fpn_v2_Opset18.onnx
[05/07/2024-14:28:14] [I] [TRT] ONNX IR version:  0.0.8
[05/07/2024-14:28:14] [I] [TRT] Opset version:    18
[05/07/2024-14:28:14] [I] [TRT] Producer name:    pytorch
[05/07/2024-14:28:14] [I] [TRT] Producer version: 2.1.0
[05/07/2024-14:28:14] [I] [TRT] Domain:
[05/07/2024-14:28:14] [I] [TRT] Model version:    0
[05/07/2024-14:28:14] [I] [TRT] Doc string:
[05/07/2024-14:28:14] [I] [TRT] ----------------------------------------------------------------
[05/07/2024-14:28:14] [E] [TRT] parsers/onnx/ModelImporter.cpp:826: While parsing node number 11 [Constant -> "/transform/Constant_2_output_0"]:
[05/07/2024-14:28:14] [E] [TRT] parsers/onnx/ModelImporter.cpp:829: --- Begin node ---
output: "/transform/Constant_2_output_0"
name: "/transform/Constant_2"
op_type: "Constant"
attribute {
  name: "value"
  t {
    dims: 2
    data_type: 7
    raw_data: "\340\000\000\000\000\000\000\000\340\000\000\000\000\000\000\000"
  }
  type: TENSOR
}

[05/07/2024-14:28:14] [E] [TRT] parsers/onnx/ModelImporter.cpp:832: --- End node ---
[05/07/2024-14:28:14] [E] [TRT] parsers/onnx/ModelImporter.cpp:834: ERROR: parsers/onnx/onnxOpImporters.cpp:5285 In function importSlice:
[8] Assertion failed: (axes.allValuesKnown()): This version of TensorRT does not support dynamic axes.
[05/07/2024-14:28:14] [E] Failed to parse onnx file

The node reported is a constant with some trivial manipulations: max on a constant tensor [224, 224] (see ReduceMax below)

Hi @eli.osherovich ,
Please share the onnx model with us.

Thanks

HI @AakankshaS

Didn’t “Steps to Reproduce” work for you?