Skip to content

dynamic shape model ValueError "could not broadcast input array from shape (224,398,3) into shape (1,1,3)" #1533

@ghylander

Description

@ghylander

Description

I have a TF2 model with undefined input shape, and I have exported it with tf2onnx with the corresponding cli argument.
The onnx -> TRT process exits with no error code. However when I try to perform an inference I get the tittle error.

in the title error, 224, 398 is the shape of the input test image

Environment

TensorRT Version: 7.1.3
NVIDIA GPU: jetson nano
NVIDIA Driver Version: jetpack 4.5.1
CUDA Version: 10.2
CUDNN Version: 8.0
Operating System: ubuntu 18.04
Python Version (if applicable): 3.8.5
Tensorflow Version (if applicable): 2.5

Relevant Files

Here the model graph:
image

Here the TF2 model summary:
image

This is the command I use to export TF2 -> onnx:
python -m tf2onnx.convert --saved-model saved_model --inputs input_2:0[-1,-1,-1,3] --output test_no_shape.onnx

This is the command I use to export onnx -> TRT:
/usr/src/tensorrt/bin/trtexec --onnx=test_no_shape.onnx --fp16 --workspace=1024 --warmUp=2 --dumpProfile --verbose --explicitBatch --saveEngine=test_no_shape.engine

Metadata

Metadata

Assignees

No one assigned

    Labels

    Module:ONNXIssues relating to ONNX usage and importtriagedIssue has been triaged by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions