xenotecc opened a new issue #17135: Exporting to ONNX format - Error in 
documentation example
URL: https://github.com/apache/incubator-mxnet/issues/17135
 
 
   ## Description
   When trying to reproduce the steps in the documentation:
   Exporting to ONNX format
   https://mxnet.apache.org/api/python/docs/tutorials/deploy/export/onnx.html
   
   The content of 5th input cell
   ```
   # Invoke export model API. It returns path of the converted onnx model
   converted_model_path = onnx_mxnet.export_model(sym, params, [input_shape], 
np.float32, onnx_file)
   ```
   throws an error.
   
   ### Error Message
   ```
   ValidationError: Unrecognized attribute: spatial for operator 
BatchNormalization
   
   ==> Context: Bad node spec: input: "data" input: "bn_data_gamma" input: 
"bn_data_beta" input: "bn_data_moving_mean" input: "bn_data_moving_var" output: 
"bn_data" name: "bn_data" op_type: "BatchNormalization" attribute { name: 
"epsilon" f: 2e-05 type: FLOAT } attribute { name: "momentum" f: 0.9 type: 
FLOAT } attribute { name: "spatial" i: 0 type: INT }
   
   ```
   
   ## To Reproduce
   The entire error can be reproduced by running such a single cell:
   ```
   import mxnet as mx
   import numpy as np
   from mxnet.contrib import onnx as onnx_mxnet
   import logging
   import os
   logging.basicConfig(level=logging.INFO)
   
   os.environ["DMLC_LOG_STACK_TRACE_DEPTH"] = "10"
   
   
   path='http://data.mxnet.io/models/imagenet/'
   [mx.test_utils.download(path+'resnet/18-layers/resnet-18-0000.params'),
    mx.test_utils.download(path+'resnet/18-layers/resnet-18-symbol.json'),
    mx.test_utils.download(path+'synset.txt')]
   
   sym = './resnet-18-symbol.json'
   params = './resnet-18-0000.params'
   
   # Standard Imagenet input - 3 channels, 224*224
   input_shape = (1,3,224,224)
   
   # Path of the output file
   onnx_file = './mxnet_exported_resnet50.onnx'
   
   converted_model_path = onnx_mxnet.export_model(sym, params, [input_shape], 
np.float32, onnx_file)
   ```
   ### Steps to reproduce
   
   1. Create virtual environment with mxnet (current version = 1.5.1)
   2. Run the above script from the section to **To Reproduce** 
   
   ## What have you tried to solve it?
   
   1. Nothing. It's an example from the documentation that I'd like to point 
out is not working.
   
   ## Environment
   
   I'm pasting the information below:
   ```
   ----------Python Info----------
   Version      : 3.6.8
   Compiler     : GCC 7.3.0
   Build        : ('default', 'Dec 30 2018 01:22:34')
   Arch         : ('64bit', '')
   ------------Pip Info-----------
   Version      : 19.3.1
   Directory    : 
/home/<username>/anaconda3/envs/mx/lib/python3.6/site-packages/pip
   ----------MXNet Info-----------
   Version      : 1.5.1
   Directory    : 
/home/<username>/anaconda3/envs/mx/lib/python3.6/site-packages/mxnet
   Num GPUs     : 0
   Commit Hash   : c9818480680f84daa6e281a974ab263691302ba8
   ----------System Info----------
   Platform     : Linux-5.0.0-37-generic-x86_64-with-debian-buster-sid
   system       : Linux
   node         : <my_pc>
   release      : 5.0.0-37-generic
   version      : #40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019
   ----------Hardware Info----------
   machine      : x86_64
   processor    : x86_64
   Architektura:           x86_64
   Tryb(y) pracy CPU:      32-bit, 64-bit
   Kolejność bajtów:       Little Endian
   CPU:                    8
   Lista aktywnych CPU:    0-7
   Wątków na rdzeń:        2
   Rdzeni na gniazdo:      4
   Gniazd:                 1
   Węzłów NUMA:            1
   ID producenta:          GenuineIntel
   Rodzina CPU:            6
   Model:                  94
   Nazwa modelu:           Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
   Wersja:                 3
   CPU MHz:                3288.055
   CPU max MHz:            3500,0000
   CPU min MHz:            800,0000
   BogoMIPS:               5184.00
   Wirtualizacja:          VT-x
   Cache L1d:              32K
   Cache L1i:              32K
   Cache L2:               256K
   Cache L3:               6144K
   Procesory węzła NUMA 0: 0-7
   Flagi:                  fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx 
pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl 
xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 
monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 
x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 
3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp 
tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 
smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt 
xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window 
hwp_epp md_clear flush_l1d
   ----------Network Test----------
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0262 
sec, LOAD: 0.6559 sec.
   Timing for GluonNLP GitHub: https://github.com/dmlc/gluon-nlp, DNS: 0.0247 
sec, LOAD: 0.9971 sec.
   Timing for GluonNLP: http://gluon-nlp.mxnet.io, DNS: 0.3047 sec, LOAD: 
0.8191 sec.
   Timing for D2L: http://d2l.ai, DNS: 0.1221 sec, LOAD: 0.2016 sec.
   Timing for D2L (zh-cn): http://zh.d2l.ai, DNS: 0.0354 sec, LOAD: 0.5605 sec.
   Timing for FashionMNIST: 
https://repo.mxnet.io/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, 
DNS: 0.2038 sec, LOAD: 0.8853 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0263 sec, LOAD: 
0.8279 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0229 sec, 
LOAD: 0.2779 sec.
   
   ```
   Cheers

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to