sacmehta / EdgeNets

This repository contains the source code of our work on designing efficient CNNs for computer vision
MIT License
412 stars 82 forks source link

Onnx export #22

Closed YuriyPryyma closed 4 years ago

YuriyPryyma commented 4 years ago

I`m exporting to onnx and got error "upsample_bilinear2d" If try to fix it as mentioned in this issue After that I got "upsample_bilinear2d because align_corners == True not supported" when i change align_corners == True to False I got "RuntimeError: Failed to export an ONNX attribute, since it's not constant, please try to make things (e.g., kernel size) static if possible"

guru-teja commented 4 years ago

I am also facing the same issue

code: torch.onnx.export(model, input, "onnx_espnet_v2_s2_384.onnx")

File "/home/guru/anaconda3/envs/EdgeNets/lib/python3.7/site-packages/torch/onnx/symbolic_helper.py", line 75, in _parse_arg raise RuntimeError("Failed to export an ONNX attribute, " RuntimeError: Failed to export an ONNX attribute, since it's not constant, please try to make things (e.g., kernel size) static if possible

Any update on this??

sacmehta commented 4 years ago

Onnx conversion requires static graph. You need to remove any conditions, variables, etc that are not static. For example, checking input and output size using if-else condition to create residual connection.

Also, there are compatibility issues between onnx and PyTorch, so you need to fix all those issues too.