PyTorch to ONNX to MXNet Tutorial

ONNX Overview

The Open Neural Network Exchange (ONNX) is an open
format used to represent deep learning models. ONNX is supported by Amazon Web Services,
Microsoft,
Facebook, and several other partners. You can design, train, and deploy deep learning
models
with any framework you choose. The benefit of ONNX models is that they can be moved
between
frameworks with ease.

This tutorial shows you how to use the Deep Learning AMI with Conda with ONNX. By
following these steps,
you can train a model or load a pre-trained model from one framework, export this
model to
ONNX, and then import the model in another framework.

ONNX Prerequisites

To use this ONNX tutorial, you must have access to a Deep Learning AMI with Conda
version 12 or later. For
more information about how to get started with a Deep Learning AMI with Conda, see
Deep Learning AMI with Conda.

Launch a terminal session with your Deep Learning AMI with Conda to begin the following
tutorial.

Convert a PyTorch Model to ONNX, then Load the Model into MXNet

First, activate the PyTorch environment:

$ source activate pytorch_p36

Create a new file with your text editor, and use the following program in a script
to
train a mock model in PyTorch, then export it to the ONNX format.