-
Notifications
You must be signed in to change notification settings - Fork 632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: ONNX export failed: Couldn't export operator aten::adaptive_avg_pool2d #63
Comments
https://github.com/onnx/tutorials/blob/master/tutorials/PytorchAddExportSupport.md Almost up to date tutorial, try to follow it. |
@MBocchi Did you resolve the problem? |
@cnaaq @MBocchi Sorry for bothering you, perhaps I have found a solution. Please see pytorch/pytorch#14395 (comment) When you transform a Pytorch model to ONNX, using |
Appreciate this @jjkislele. Solved my problem. |
I faced the a similar issue as described above:
and successfully exported the model with the flag
I therefore do not consider this as a solution. Does anyone have an idea on what else could be tried out? |
@PatrickNa In fact, I face this problem when I want to convert my PyTorch model to TensorRT/OpenVINO model via ONNX. I have tried another PyTorch pool operation: nn.AvgPooling instead of nn.AdaptiveAvgPool2d. So perhaps, you might replace the max pool function based on PyTorch. Hope it would help you. :-D |
I use the code to convert Adaptivateavgpool2d --> Avgpool2, and i export onnx successful! import torch m = nn.AdaptiveAvgPool2d((None,1)) add code for adaptiveavgpool2d -> avgpoll2dalist = torch.randn(64, 26, 512, 1) stridesz = np.floor((inputsz / outputsz)) kernelsz = inputsz - (outputsz - 1) * stridesz print(alist) |
Some support for this op was added in pytorch/pytorch#17412. @jcwchen can you please close this issue? |
Your suggest help me solve this and finally I exported *.onnx |
Hi I've tried to export PyTorch model to ONNX as following:
input_shape = (3, 224, 224)
model_onnx_path = "torch_model.onnx"
dummy_input = Variable(torch.randn(1, *input_shape).cuda())
output = torch.onnx.export(model, dummy_input, model_onnx_path, verbose=False)
And I got this error:
UserWarning: ONNX export failed on ATen operator adaptive_avg_pool2d because torch.onnx.symbolic.adaptive_avg_pool2d does not exist
RuntimeError: ONNX export failed: Couldn't export operator aten::adaptive_avg_pool2d
How I can fixed it? Thank you
The text was updated successfully, but these errors were encountered: