Exporting HybridBlock using ONNX format



Can you please explain how to export a network using onnx_mxnet.export_model without first writing symbolic graph and parameters to file system.
Right now I’m doing it with the following code

import mxnet as mx
from mxnet import nd, gluon
from mxnet.contrib import onnx as onnx_mxnet

net = gluon.nn.Dense(1, in_units=2)
net.export('model', epoch=1)
onnx_mxnet.export_model('model-symbol.json', 'model-0001.params', [(1,2)])

In the MXNet ONNX documentation for onnx_mxnet.export_model it is stated that


  • sym ( str or symbol object ) – Path to the json file or Symbol object
  • params ( str or symbol object ) – Path to the params file or params dictionary. (Including both arg_params and aux_params)

What are Symbol object and params dictionary and how can I extract them conveniently from net ?