-
Notifications
You must be signed in to change notification settings - Fork 30
Reshape operator expects Shape(tuple) #49
Comments
The Reshape operator expects a shape attribute to be present. But the reshape operator in you model has no shape attribute. This is what is causing the error. I checked your model, it seems to have Also mxnet's ONNX import has been moved into mxnet here - https://github.com/apache/incubator-mxnet/tree/master/python/mxnet/contrib/onnx I would encourage you to use the new code. |
MXNet supports ONNX release v1.1 I see that the reshape operator definition has changed since then with this PR - onnx/onnx#608 Reshape now expects shape as an input and not an attribute. We will fix this in the latest code. But I think if you use ONNX v1.1 for exporting your pytorch model, it should work fine. Let me know if you have further questions. |
Thanks, will try those suggestions tonight |
Hi @anirudhacharya, I'm not sure I understand your previous suggestion. You suggested using ONNX 1.1 to export my pytorch model, but I've looked through the pytorch code on master, and I don't find any mention of ONNX versions in there. The sample that I submitted in this ticket was generated by pytorch 0.4.0, which was released 8 days ago, and I don't find any mention in the pytorch history of a change to the reshape export, in the last 8 days. |
@bmharper I should have been more clear. The definition of Reshape changed on March 16th with this PR. MXNet supports ONNX v1.1.1 which includes commits till March 9th. So MXNet's import expects the older definition of Reshape. Whereas Pytorch v0.4 includes this new change, so when you export with pytorch v0.4 your model will get serialized with the new definition of the reshape operator. This is what is causing the inconsistency. We are working on fixing this. It would be great if you could wait. |
Version: onnx-mxnet (0.4.2)
Breaking file: sequence-tiny.zip
I'm getting the following error when trying to import my ONNX model:
The model has a conv net that feeds into a GRU. The model is built for OCR, so it turns the horizontal axis into the sequence axis.
These are the two lines of PyTorch code that cause the error:
Specifically, the
x.view
is what causes the errorDuring the PyTorch -> ONNX export, the relevant breaking lines are:
Any ideas what's going wrong here?
The text was updated successfully, but these errors were encountered: