IShuffleLayer /Reshape_8: reshaping failed for tensor

Description

onnx model fail to work in tensorrt .

Error[7]: [shapeMachine.cpp::executeContinuation::864] Error Code 7: Internal Error (IShuffleLayer /Reshape_8: reshaping failed for tensor: /Mul_14_output_0 reshape would change volume 0 to 1 Instruction: RESHAPE_ZERO_IS_PLACEHOLDER{0} {}.)

Environment

TensorRT Version:
GPU Type:
Nvidia Driver Version:
CUDA Version:
CUDNN Version:
Operating System + Version:
Python Version (if applicable):
TensorFlow Version (if applicable):
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):

Hi @mochenghh ,
ONNX Reshape has an attribute “allowzero” for turning off “zero as placeholder”. Attached script shows how to set it.

# Script for setting allowzero attribute on all ONNX Reshape operations.
# It will break networks that depend upon ONNX's ad-hoc rule for Reshape
# where "0 means forward input dimension", and fix networks that need
# "0 means 0".
#
# Warning: "allowzero" was introduced by ONNX opset 14. If your file
# uses an earlier opset, you will need TensorRT 8.5.2 or later,
# which recognizes "allowzero" for opset 5 and later as an extension.

import onnx
import onnx_graphsurgeon as gs

graph = gs.import_onnx(onnx.load("original.onnx"))

for node in graph.nodes:
    if node.op == "Reshape":
        node.attrs["allowzero"] = 1

onnx.save(gs.export_onnx(graph), "repaired.onnx")

Can you please try that
Thanks