-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Failed to convert pytorch networks with "torch.view()" to mxnet with ONNX #14916
Comments
Hey, this is the MXNet Label Bot. |
@mxnet-label-bot add [ONNX] @nicklhy Thanks for reporting this, we will look into this issue |
After a deeper look at the source code. I noticed the convert function for "reshape" tries to read the "shape" values from the graph params dict at python/mxnet/contrib/onnx/onnx2mx/_op_translations.py#L462.
However, the "shape" tensor in ONNX has never been read and saved in that params dict. I managed to solve this problem by adding two lines listed below in python/mxnet/contrib/onnx/onnx2mx/import_onnx.py when performing the operator conversion
BTW, this may not work in the dynamic reshape case. |
@nicklhy is this fix being pushed to the repo? |
@ahmed-shariff No, the above fix has not been pushed to the official repo yet. |
Hi, there!
It seems that the current mxnet could not convert basic CNN models like alexnet, resnet from pytorch simply because the shape in ONNX is defined as a Tensor rather than attribute (which is mentioned here).
Are there any specific plans of solving this problem ?
Notice that the error could even occur when it is not a dynamic reshape. A simple script to produce is like below
Error message is
The text was updated successfully, but these errors were encountered: