Padding layer default mode missing
Opened this issue · 2 comments
It appears that the "mode" parameter in ONNX padding layers is optional, and a default 'constant' value is to be considered in this case (see in [https://github.com/onnx/onnx/blob/master/docs/Operators.md#Pad]).
I have a ONNX model to convert where this mode parameter is missing on some pad layer and this caused the conversion to fail.
I have implemented a workaround replacing line 19 in file padding_layers.py
params['mode'] = params['mode'].decode('ascii')
with following code:
try:
params['mode'] = params['mode'].decode('ascii')
except:
params['mode'] = 'constant'
This solves the issue.
Hi, @bwery ! As I can understand from Onnx documentation: constant is the default mode.
mode : string (default is constant)
Supported modes: `constant`(default), `reflect`, `edge`
It's quite strange that some layers don't have a pad 'mode' attribute.
If you want, you can make PR for your changes or we will fix it a little bit later.
Thank you for your interest in the project!
Hello, I am not used with the introduction of pull requests on Github. So, i would prefer somebody skilled makes the change !
Thank you anyway for your answer !