-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shape Error (reshape wildcard -1 has infinite number of solutions or no solution. Reshaping [0,16] to [0,-1].) #2796
Comments
I would try fix the input shape first, see https://github.com/NVIDIA/TensorRT/tree/main/tools/Polygraphy/examples/cli/surgeon/03_modifying_input_shapes |
If it still doesn't work then could you share the onnx here? Thanks! |
I've tried to fix the input shape with polygraphy, it didn't work. I'm using the Faster-RCNN.onnx model. You can find the model in here: https://github.com/onnx/models/blob/main/vision/object_detection_segmentation/faster-rcnn/model/FasterRCNN-10.onnx |
Looks like this model is not supported by TRT yet...
FYI the input should be [3, 1024, 1024]?
|
Sorry This is known limitation that TRT not support UINT8 as intermediate tensors. see https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#types-precision |
I got same error. It has no solution yet? |
Any updates on this issue? |
Unfortunately I couldn't use the Faster RCNN onnx model with onnxruntime + TensorRT provider. I had to use different model for my project. |
I finally got it working using this code:
Source: https://forums.developer.nvidia.com/t/conversion-of-fasterrcnn-onnx-model-to-tensorrt-fails/313065 |
Description
I'm trying to convert the faster-rcnn.pt file to the onnx and use it with onnxruntime-gpu and tensorrt provider. When I check the converted onnx with trtexec, I get an Shape Error. One of the node has [0,16] input and that node tries to reshape it [0,-1]. Is there any way to assign the shape of the node manually ? It is because of the tools versions that I used ?
Environment
TensorRT Version: 8.6
NVIDIA GPU: Quadro RTX 4000
NVIDIA Driver Version: 530.30.02
CUDA Version: 12.1
CUDNN Version:
Operating System: Ubuntu 18.04
Python Version (if applicable): 3.9
Tensorflow Version (if applicable):
PyTorch Version (if applicable): 1.7.1
Baremetal or Container (if so, version):
Steps To Reproduce
1.Exported onnx from PyTorch weight file (faster-rcnn model)
dynamic_axes = {"input":{0:"batch_size"},
"boxes":{0:"batch_size"},
"labels":{0:"batch_size"},
"scores":{0:"batch_size"}}
torch.onnx.export(
model.to("cuda"),
dummy_input.to("cuda"),
onnx_filename,
verbose = True,
opset_version = 12,
input_names = input_names,
output_names = output_names,
dynamic_axes = dynamic_axes,
do_constant_folding=True
)
2.Applied polygraphy surgeon
polygraphy surgeon sanitize n.onnx --fold-constants --output n2.onnx
trtexec --onnx=n2.onnx --shapes=input:1x2x2024x2024 --verbose
ERROR: Reshape node, infinite solution for Reshaping [0,16] to [0,-1].
...
[03/22/2023-10:30:08] [E] [TRT] ModelImporter.cpp:770: input: "2881"
input: "2897"
output: "2898"
name: "Reshape_1605"
op_type: "Reshape"
[03/22/2023-10:30:08] [E] [TRT] ModelImporter.cpp:771: --- End node ---
[03/22/2023-10:30:08] [E] [TRT] ModelImporter.cpp:774: ERROR: ModelImporter.cpp:195 In function parseGraph:
[6] Invalid Node - Reshape_1605
[shapeContext.cpp::operator()::3546] Error Code 4: Shape Error (reshape wildcard -1 has infinite number of solutions or no solution. Reshaping [0,16] to [0,-1].)
[03/22/2023-10:30:08] [E] Failed to parse onnx file
[03/22/2023-10:30:08] [I] Finished parsing network model. Parse time: 0.284967
[03/22/2023-10:30:08] [E] Parsing model failed
[03/22/2023-10:30:08] [E] Failed to create engine from model or file.
[03/22/2023-10:30:08] [E] Engine set up failed
&&&& FAILED TensorRT.trtexec [TensorRT v8600] # /usr/src/tensorrt/bin/trtexec --onnx=n2.onnx --shapes=input:1x2x2024x2024 --verbose
The text was updated successfully, but these errors were encountered: