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

Incorrect MAC calculation for Conv3D #35

Open hamoudyounesyounes opened 1 year ago

hamoudyounesyounes commented 1 year ago

It seems that the tool accounts only for kernel_x and kernel_y when computing Conv3D MACs:

For W: 8x1x3x3x3, Input: 1x1x32x64x64, Output: 1x8x32x64x64

So if I use only kernel_x and kernel_y (Accounting for a 2D kernel): MACs = 10.48576 M <---- tool output

If I use kernel_x, kernel_y and kernel_z (Accounting for a 3D kernel): MACs = 28.31 M <---- calculated as: output_size (in_C // groups (kernel_x kernel_y kernel_z) + bias)

ThanatosShinji commented 1 year ago

The bug has been fixed and verified through your case. The new code will be released soon.

ThanatosShinji commented 1 year ago

v0.7.4 is just released. Please upgrade your onnx-tool to this version and verify the fix.