Skip to content

Use onnx_tool to fix TensorRT's model issues

ThanatosShinji edited this page Nov 10, 2022 · 4 revisions
[11/10/2022-20:33:00] [E] [TRT] ModelImporter.cpp:779: ERROR: builtin_op_importers.cpp:647 In function importConv:
[8] Assertion failed: inputs.at(2).is_weights() && "The bias tensor is required to be an initializer for the Conv operator."
[11/10/2022-22:33:27] [E] [TRT] ModelImporter.cpp:779: ERROR: builtin_op_importers.cpp:3608 In function importResize:
[8] Assertion failed: scales.is_weights() && "Resize scales must be an initializer!"

Root cause:
pytorch to ONNX conversion created Identity layer for bias tensor. like:
image

image

Solution:

#onnx-tool version >=0.3.2
python -m onnx_tool -m rm_iden -i raw.onnx -o removed.onnx

After:
image image
Now TensorRT can execute this onnx model.

Clone this wiki locally