ThanatosShinji / onnx-tool

A parser, editor and profiler tool for ONNX models.
https://pypi.org/project/onnx-tool/
MIT License
399 stars 52 forks source link

fix the crash bug when Gemm nodes have a 1-D input #74

Closed veritas-Qiu closed 8 months ago

veritas-Qiu commented 8 months ago

in some cases, matmul node will have 1-D cases, which will make onnx_tool.model_profile() crash as a example, (export an onnx model of YOLOv8-seg). Then one of matmul nodes might be like below. image This node's secend input have only 1 dim, so we should care nothing about it when counting macs, but program will crash when it try to get the -2 dim of the tensor, this PR try to fix that.

ThanatosShinji commented 8 months ago

Thanks for your contribution!