ieee8023 opened a new issue #13395: Cannot import alexnet model from pytorch 
with ONNX
URL: https://github.com/apache/incubator-mxnet/issues/13395
 
 
   I cannot import the alexnet model from pytorch. I receive this error:
   
   ```
     File "test.py", line 5, in <module>
       sym, arg, aux = mx.contrib.onnx.import_model('alexnet.onnx')
     File 
"/Users/ieee8023/Library/Python/2.7/lib/python/site-packages/mxnet/contrib/onnx/onnx2mx/import_model.py",
 line 53, in import_model
       sym, arg_params, aux_params = graph.from_onnx(model_proto.graph)
     File 
"/Users/ieee8023/Library/Python/2.7/lib/python/site-packages/mxnet/contrib/onnx/onnx2mx/import_onnx.py",
 line 115, in from_onnx
       mxnet_sym = self._convert_operator(node_name, op_name, onnx_attr, inputs)
     File 
"/Users/ieee8023/Library/Python/2.7/lib/python/site-packages/mxnet/contrib/onnx/onnx2mx/import_onnx.py",
 line 61, in _convert_operator
       op_name, new_attrs, inputs = convert_map[op_name](attrs, inputs, self)
     File 
"/Users/ieee8023/Library/Python/2.7/lib/python/site-packages/mxnet/contrib/onnx/onnx2mx/_op_translations.py",
 line 418, in reshape
       reshape_shape = list(proto_obj._params[inputs[1].name].asnumpy())
   KeyError: 'concat0'
   ```
   
   Here is code to reproduce the issue 
   ```
   import torch, torchvision
   import mxnet, mxnet.contrib.onnx
   
   model = torchvision.models.alexnet(pretrained=True)
   model.train(False)
   
   dummy_input = torch.autograd.Variable(torch.randn(1, 3, 224, 224))
   torch.onnx.export(model, dummy_input, 'alexnet.onnx')
   
   sym, arg, aux = mxnet.contrib.onnx.import_model('alexnet.onnx')
   ```
   
   ```
   >>> import mxnet
   >>> mxnet.__version__
   '1.3.0'
   >>> import onnx
   >>> onnx.__version__
   u'1.3.0'
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to