Open P-Light opened 4 years ago
What the model did you try to convert?
Custom CNN. Backbone is resnet34.
@P-Light have you found any solution? I'm also facing same issue. My model is CRNN backbone is Resnet. My package's version is also same as you.
@ShahrearBinAmin unfortunately I didn't.
@theotheo I'm also facing same issue. I've converted my pytroch model to onnx. It was exported my torch model with the following parameters
onnx.export(self.net_,
x,
"saved_models/anpr.onnx",
opset_version=11,
operator_export_type=onnx.OperatorExportTypes.ONNX_ATEN_FALLBACK,
input_names=["input"],
output_names=["output"])
If I pass operator_export_type=onnx.OperatorExportTypes.ONNX
I get adaptive_max_pool2d
not supported
@P-Light can you share your onnx model file for debug?
@chinhuang007 I'm also facing same error. You can check my onnx model file here, I've also tried to load the model in onnx-runtime
but got error
Fatal error: adaptive_max_pool2d is not a registered function/op
created an issue in onnx-runtime
repo here they replied
Please report this to PyTorch as the exported onnx model is not valid because onnx doesn’t support ‘adaptive_max_pool2D’ in any opset version.
but adaptive_max_pool2d
is supported from opset version 9, it's mapped to equivalent MaxPool
of onnx.
adaptive_max_pool2d = _adaptive_pool('adaptive_max_pool2d', "MaxPool", _pair, max_pool2d_with_indices)
With some debugging, I found this node with type "adaptive_max_pool2d" and domain "org.pytorch.aten" causing the error. We currently support ONNX default domain only. So this model would not convert properly to tensorflow. The reason is that we don't understand what adaptive_max_pool2d means in org.pytorch.aten domain.
Your statement about adaptive_max_pool2d mapped to MaxPool is based on the code in Pytorch, not ONNX standard. I would recommend to find out whether the Pytorch to ONNX converter can change the node type to "MaxPool" and domain to "" which is the default for ONNX. Once that is fixed, the ONNX model should work in ONNX runtime and ONNX-TF.
@P-Light can you share your onnx model file for debug?
Sure, download here.
@P-Light I found the similar issue with your model, a node with type="adaptive_avg_pool2d" and domain="org.pytorch.aten". So currently this model would not convert to tensorflow because we don't understand what adaptive_max_pool2d means in org.pytorch.aten domain.
Hello, I tried to convert model from onnx to tensorflow by CLI. Tensorflow successfully started up but there is runtime error without any details except this one:
onnx==1.6.0 onnx-tf==1.5.0 tensorflow==2.1.0