ONNX转TRT
[E] [TRT] Concat_70: all concat input tensors must have the same dimensions except [8] Assertion failed: axis >= 0 && axis < nbDims
首先介绍本人模型流程
- 使用split划分出2个输出x1, x2
- x1 = torch.zeros_like(x1), x2不变。
- 在concat(x1,x2)
- 最后经过onnx简化
from onnxsim import simplify
simplify(model.onnx)
虽然onnx不报错,但转TRT中concat报维度未对齐。
将x1 = torch.zeros_like(x1) 改为 x1 = x1 * 0.0
TRT不报错
RROR: builtin_op_importers.cpp:474 In function importConv: [8] Assertion failed: inputs.at(2).is_weights()
可能是torch版本高了,使用
from onnxsim import simplify
simplify(model.onnx)