Open nicklhy opened 5 years ago
Hey, this is the MXNet Label Bot. Thank you for submitting the issue! I will try and suggest some labels so that the appropriate MXNet community members can help resolve it. Here are my recommended labels: ONNX, Bug
@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.
reshape_shape = list(proto_obj._params[inputs[1].name].asnumpy())
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
if op_name == 'Constant':
self._params[mxnet_sym.name] = self._parse_array(node.attribute[0].t)
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