IShuffleLayer applied to shape tensor must have 0 or 1 reshape dimensions: dimensions were [-1,2])


While parse the attached onnx model the following error is raised:

[shuffleNode.cpp::nvinfer1::builder::ShuffleNode::symbolicExecute::387] Error Code 4: Internal Error (Reshape_77: IShuffleLayer applied to shape tensor must have 0 or 1 reshape dimensions: dimensions were [-1,2])


TensorRT Version:
GPU Type: Quadro RTX 3000
Nvidia Driver Version: 471.11
CUDA Version: 11.2
CUDNN Version: 8.1.1
Operating System + Version: Window 10
Python Version (if applicable): 3.6.8
TensorFlow Version (if applicable): NA
PyTorch Version (if applicable): NA
Baremetal or Container (if container which image + tag): Baremetal

Relevant Files

grid_sample.onnx (8.6 KB)

Steps To Reproduce

builder = trt.Builder(self.logger)
networkFlags = 1 << (int)(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)
network = builder.create_network(self.networkFlags)
parser = trt.OnnxParser(network, Logger())
# Open the model in binary format - set its data into buffer
modelFD = open(‘grid_sample.onnx’, ‘rb’)
modelBuffer =
# Check and determine whether or not an Onnx model is compatible with TRT
supportsModelInfo = parser.supports_model(modelBuffer)

Please refer to the below link for Sample guide.

Refer to the installation steps from the link if in case you are missing on anything

However suggested approach is to use TRT NGC containers to avoid any system dependency related issues.

In order to run python sample, make sure TRT python packages are installed while using NGC container.

In case, if you are trying to run custom model, please share your model and script with us, so that we can assist you better.

My custom model is attached.


I think padding related node is causing error, we don’t support 2D shape tensors yet. We can try workaround constant-fold with polygraphy. After this we are able to successfully generate engine. Please try

polygraphy surgeon sanitize --fold-constants grid_sample.onnx -o 2001833/folded.onnx

For more details,

Thank you.