nopattern edited a comment on issue #14589: convert from mxnet to onnx failed, 
with Unrecognized attribute: spatial for operator BatchNormalization
URL: 
https://github.com/apache/incubator-mxnet/issues/14589#issuecomment-508975646
 
 
   I have convert mxnet(1.5.0) to the onnx(1.5.0), the error is:
   
     `INFO:root:Converting idx: 3, op: null, name: 
first-3x3-conv-batchnorm_gamma
   INFO:root:Converting idx: 4, op: null, name: first-3x3-conv-batchnorm_beta
   INFO:root:Converting idx: 5, op: null, name: 
first-3x3-conv-batchnorm_moving_mean
   Traceback (most recent call last):
     File 
"/home/deep/workssd/work/pycharm-community-2019.1.1/helpers/pydev/pydevd.py", 
line 1741, in <module>
       main()
     File 
"/home/deep/workssd/work/pycharm-community-2019.1.1/helpers/pydev/pydevd.py", 
line 1735, in main
       globals = debugger.run(setup['file'], None, None, is_module)
     File 
"/home/deep/workssd/work/pycharm-community-2019.1.1/helpers/pydev/pydevd.py", 
line 1135, in run
       pydev_imports.execfile(file, globals, locals)  # execute the script
     File 
"/home/deep/workssd/work/pycharm-community-2019.1.1/helpers/pydev/_pydev_imps/_pydev_execfile.py",
 line 18, in execfile
       exec(compile(contents+"\n", file, 'exec'), glob, loc)
     File "/home/deep/workssd/arm/tvm_app/tune_relay_mobile_gpu.py", line 484, 
in <module>
       tune_and_evaluate(tuning_option)
     File "/home/deep/workssd/arm/tvm_app/tune_relay_mobile_gpu.py", line 436, 
in tune_and_evaluate
       net, params, input_shape, _ = get_network(network, batch_size=1)
     File "/home/deep/workssd/arm/tvm_app/tune_relay_mobile_gpu.py", line 93, 
in get_network
       return get_network_lpr_mb2(name,batch_size)
     File "/home/deep/workssd/arm/tvm_app/tune_relay_mobile_gpu.py", line 143, 
in get_network_lpr_mb2
       test_onnx()
     File "/home/deep/workssd/arm/tvm_app/tune_relay_mobile_gpu.py", line 135, 
in test_onnx
       converted_model_path = onnx_mxnet.export_model(mx_sym, args, 
[input_shape], np.float32, onnx_file, True)
     File 
"/home/deep/workssd/mxnet/incubator-mxnet/python/mxnet/contrib/onnx/mx2onnx/export_model.py",
 line 87, in export_model
       verbose=verbose)
     File 
"/home/deep/workssd/mxnet/incubator-mxnet/python/mxnet/contrib/onnx/mx2onnx/export_onnx.py",
 line 234, in create_onnx_graph_proto
       in_shape=in_shape[graph_input_idx],
   IndexError: list index out of range
   Error in sys.excepthook:
   Traceback (most recent call last):
     File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in 
apport_excepthook
       from apport.fileutils import likely_packaged, get_recent_crashes
     File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in 
<module>
       from apport.report import Report
     File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in 
<module>
       import apport.fileutils
     File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in 
<module>
       from apport.packaging_impl import impl as packaging
     File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, 
in <module>
       import apt
     File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
       import apt_pkg
   ModuleNotFoundError: No module named 'apt_pkg'
   
   Original exception was:
   Traceback (most recent call last):
     File 
"/home/deep/workssd/work/pycharm-community-2019.1.1/helpers/pydev/pydevd.py", 
line 1741, in <module>
       main()
     File 
"/home/deep/workssd/work/pycharm-community-2019.1.1/helpers/pydev/pydevd.py", 
line 1735, in main
       globals = debugger.run(setup['file'], None, None, is_module)
     File 
"/home/deep/workssd/work/pycharm-community-2019.1.1/helpers/pydev/pydevd.py", 
line 1135, in run
       pydev_imports.execfile(file, globals, locals)  # execute the script
     File 
"/home/deep/workssd/work/pycharm-community-2019.1.1/helpers/pydev/_pydev_imps/_pydev_execfile.py",
 line 18, in execfile
       exec(compile(contents+"\n", file, 'exec'), glob, loc)
     File "/home/deep/workssd/arm/tvm_app/tune_relay_mobile_gpu.py", line 484, 
in <module>
       tune_and_evaluate(tuning_option)
     File "/home/deep/workssd/arm/tvm_app/tune_relay_mobile_gpu.py", line 436, 
in tune_and_evaluate
       net, params, input_shape, _ = get_network(network, batch_size=1)
     File "/home/deep/workssd/arm/tvm_app/tune_relay_mobile_gpu.py", line 93, 
in get_network
       return get_network_lpr_mb2(name,batch_size)
     File "/home/deep/workssd/arm/tvm_app/tune_relay_mobile_gpu.py", line 143, 
in get_network_lpr_mb2
       test_onnx()
     File "/home/deep/workssd/arm/tvm_app/tune_relay_mobile_gpu.py", line 135, 
in test_onnx
       converted_model_path = onnx_mxnet.export_model(mx_sym, args, 
[input_shape], np.float32, onnx_file, True)
     File 
"/home/deep/workssd/mxnet/incubator-mxnet/python/mxnet/contrib/onnx/mx2onnx/export_model.py",
 line 87, in export_model
       verbose=verbose)
     File 
"/home/deep/workssd/mxnet/incubator-mxnet/python/mxnet/contrib/onnx/mx2onnx/export_onnx.py",
 line 234, in create_onnx_graph_proto
       in_shape=in_shape[graph_input_idx],
   IndexError: list index out of range`
   
   
       I tracked the code and  found the 'batchnorm_moving_mean' failed because 
it is not in saved params. so the in_shape[graph_input_idx] is out of bound. 
       Anyone has suggestion?
   
   @vandanavk 

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


With regards,
Apache Git Services

Reply via email to