...
For example,
- Gluon
mx.gluon.import_from(input_file)
mx.gluon.export_to(format=’onnx’, filename_prefix=”model_name”)
...
sym, params = mx.mod.Module.import_from(input_file, in_format=‘onnx’)
mx.mod.Module.export_to(format=‘onnx’, filename_prefix=”model_name”)
...
# This will internally call serde package API `serde.export`
mx.mod.Module.export_to(sym, params, format=‘onnx’, filename=”model.onnx”)
# OR save into different format using module directly
mx.mod.Module.export_to(format=‘onnx’, filename=”model.onnx”)
...
sym, params = mxnet.mod.Module.import_from(input_file, in_format=‘onnx’)
# create module for inference
mod = mx.mod.Module(symbol=sym, data_names=..., context=mx.cpu(), label_names=None)
mod.bind(for_training=False, data_shapes=..., label_shapes=None)
# set parameters
mod.set_params(arg_params=params, aux_params=None, allow_missing=True)
# forward on the provided data batch
mod.forward(Batch([data_batch]))
...