ThanatosShinji / onnx-tool

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

Increase length of default attributes of convolution nodes #57

Closed ashay closed 11 months ago

ashay commented 11 months ago

The size of pads, strides, and dilations attributes depends on the size of the input tensor, but our default values for these attributes uses a fixed size (four for pads, two for strides and dilations), which causes the code to crash when the input tensor is 5D.

We, of course, cannot determine the shape of the input tensor in the __init__ function of ConvNode (since the input tensor isn't available), but based on the fact that we only handle up to 5D input tensors, this patch sets the default value of the attributes to work with the maximum input size.