tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

check_model gives 'Bad node spec' error

Open aviaisr opened this issue 5 years ago • 2 comments

Hi,

I'm trying to convert onnx to pb. The onnx file loading is done successfully. Then, I call prepare (a function of onnx_tf.beckend). This function calls onnx.checker.check_model -> that calls C.check_model(model.SerializeToString()).

I get these error lines: Traceback (most recent call last): File "C:/CP/DL_REPOSITORIES/pytorch-onnx-tensorflow-pb/convert_pytorch2onnx2tfpb.py", line 103, in tf_rep = prepare(onnx_model, strict=False) File "C:\ProgramData\Anaconda3\lib\site-packages\onnx_tf\backend.py", line 53, in prepare super(TensorflowBackend, cls).prepare(model, device, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\onnx\backend\base.py", line 74, in prepare onnx.checker.check_model(model) File "C:\ProgramData\Anaconda3\lib\site-packages\onnx\checker.py", line 91, in check_model C.check_model(model.SerializeToString()) onnx.onnx_cpp2py_export.checker.ValidationError: Node () has input size 1 not in range [min=2, max=3].

==> Context: Bad node spec: input: "708" output: "715" op_type: "Pad" attribute { name: "mode" s: "constant" type: STRING } attribute { name: "pads" ints: 0 ints: 0 ints: 0 ints: 0 ints: 0 ints: 0 ints: 0 ints: 0 type: INTS } attribute { name: "value" f: 0 type: FLOAT }

Can you please help?

aviaisr avatar Nov 17 '19 09:11 aviaisr

I'm working with this onnx version version = '1.6.0' git_version = '553df22c67bee5f0fe6599cff60f1afc6748c635'

aviaisr avatar Nov 17 '19 10:11 aviaisr

Pad operator was recently updated (https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Pad-13) Per the new spec min of 2 inputs are required for this operator. In order to fix this issue you should update your Pad operator. Alternatively you can use an older opset for onnx

askhade avatar Jun 30 '20 16:06 askhade