ONNX is an open format to represent deep learning models. With ONNX as an intermediate representation, it is easier to move models between state-of-the-art tools and frameworks for training and inference.

The mxnet.contrib.onnx package refers to the APIs and interfaces that implement ONNX model format support for Apache MXNet.

With ONNX format support for MXNet, developers can build and train models with a variety of deep learning frameworks, and import these models into MXNet to run them for inference and training using MXNet’s highly optimized engine.


This package contains experimental APIs and may change in the near future.

Installation Instructions

  • To use this module developers need to install ONNX, which requires the protobuf compiler to be installed separately. Please follow the instructions to install ONNX and its dependencies. MXNet currently supports ONNX v1.2.1. Once installed, you can go through the tutorials on how to use this module.

This document describes all the ONNX-MXNet APIs.

mxnet.contrib.onnx.import_model Imports the ONNX model file, passed as a parameter, into MXNet symbol and parameters.
mxnet.contrib.onnx.get_model_metadata Returns the name and shape information of input and output tensors of the given ONNX model file.
mxnet.contrib.onnx.import_to_gluon Imports the ONNX model files, passed as a parameter, into Gluon SymbolBlock object.
mxnet.contrib.onnx.export_model Exports the MXNet model file, passed as a parameter, into ONNX model.

ONNX Examples

API Reference