onnx / tutorials

Tutorials for creating and using ONNX models
Apache License 2.0
3.39k stars 630 forks source link

caffe2->onnx error: Unrecognized attribute: dilations for operator MaxPool #156

Open WeiyiLi opened 5 years ago

WeiyiLi commented 5 years ago

Hi,

I followed the tutorial in https://github.com/onnx/tutorials/blob/master/tutorials/Caffe2OnnxExport.ipynb to convert the caffe2 model to onnx. However, the conversion didn't succeed to report error

....
"onnx.onnx_cpp2py_export.checker.ValidationError: Unrecognized attribute: dilations for operator MaxPool
"
==> Context: Bad node spec: input: "57" output: "58" name: "" op_type: "MaxPool" attribute { name: "kernel_shape" ints: 3 ints: 3 type: INTS } attribute { name: "pads" ints: 0 ints: 0 ints: 0 ints: 0 type: INTS } attribute { name: "dilations" ints: 1 ints: 1 type: INTS } attribute { name: "strides" ints: 2 ints: 2 type: INTS }

The version of onnx I am using is the latest version from the github. How can I solve this problem? Thank you!

jackkun303 commented 5 years ago

i faced an similar problem when i convert the pytorch to onnx model, the error is describted as follow: "onnx eport failed on max_pool2d_with_indices because dilation not supported ". i also try every version of onnx(from1.4.1 to 1.6.0); but it doesn't work. Thanks.

askhade commented 4 years ago

dilation attribute was added for MaxPool from opset version 10. Are you sure you tried converting to onnx opset 10 or above? FYI @spandantiwari