Hybrid Front-End

The Gluon Python API lets you use Apache MXNet in a fully imperative manner. It also allows you to simply switch to symbolic mode by calling the hybridize functionality. The symbolic execution provides faster and more optimized execution as well as the ability to export the network for inference in different language bindings like java or C++.

net = model_zoo.vision.resnet50_v2(pretrained=True)
net.hybridize()

dummy_input = mx.nd.ones(shape=(1,3,224,224))
net(dummy_input)

net.export("symbolic_resnet50")
        


Distributed Training

import horovod.mxnet as hvd

# Horovod: initialize Horovod
hvd.init()

# Horovod: pin a GPU to be used to local rank
context = mx.gpu(hvd.local_rank())
        

Apache MXNet allows you to make the most out of your hardware, whether it is multi-gpu or multi-host training with near-linear scaling efficiency. Apache MXNet recently introduced support for Horovod, the distributed learning framework developed by Uber.



8 Language Bindings

Deep integration into Python and support for Scala, Julia, Clojure, Java, C++, R and Perl. Combined with the hybridization feature, this allows a very smooth transition from Python training to deployment in the language of your choice to shorten the time to production.

import org.apache.mxnet.javaapi.*;
...
List
<DataDesc> inputDesc = new ArrayList<>();
Shape inputShape = new Shape(new int[]{1, 3, 224, 224});
inputDesc.add(new DataDesc("data", inputShape, DType.Float32(), "NCHW"));
Predictor predictor = new Predictor(inst.modelPathPrefix, inputDesc, context,0);
...
float[][] result = predictor.predict(new float[][]{img.toArray()});