ThanatosShinji / onnx-tool

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

how to solve macs calculation problem #91

Closed Christian-lyc closed 2 hours ago

Christian-lyc commented 3 hours ago

I got this error when I want to calculate macs of yolo8.onnx model. The error happens at m.graph.shape_infer function. Doesn anyone can help me with this error? Thank you so much.

File "/export/home/yliu/object_detection/quantization/quanti.py", line 206, in m.graph.shape_infer({'data': np.zeros((1, 3, 640, 640))}) File "/export/home/yliu/miniconda3/envs/ticks/lib/python3.12/site-packages/onnx_tool/graph.py", line 992, in shape_infer node.shape_infer(itensors, otensors) File "/export/home/yliu/miniconda3/envs/ticks/lib/python3.12/site-packages/onnx_tool/node.py", line 155, in shape_infer self.value_infer(intensors, outtensors) File "/export/home/yliu/miniconda3/envs/ticks/lib/python3.12/site-packages/onnx_tool/node.py", line 158, in value_infer raise NotImplementedError(f'this Node {self.op_type}-{self.name} has no value_infer') NotImplementedError: this Node DynamicQuantizeLinear-images_QuantizeLinear has no value_infer

Christian-lyc commented 2 hours ago

Sorry, this works, https://github.com/ThanatosShinji/onnx-tool/blob/main/benchmark/pytorch_example.py https://pypi.org/project/onnx-tool/0.1.7/