Difficulty: Beginner
Estimated Time: 10 minutes

Gluon in 60 seconds

Apache MXNet and the Gluon interface provide a declarative and imperative interface to a complete Deep Learning and machine learning framework. In this module you will take a crash course to trial the Gluon interface and build a convolutional neural network (CNN) to detect and classify the class MNIST data set. For more tutorials please stay tuned to Katacoda and visit the home of MXNet and Gluon at


Note: All content in these modules is derived if not completely copy and pasted from Deep Learning - The Straight Dope found at the link above.

Now, lets get started...


You might notice that by using gluon, we get code that runs much faster whether on CPU or GPU. That’s largely because gluon can call down to highly optimized layers that have been written in C++.

Gluon in 60 seconds

Step 1 of 9

Step 1

Your first deep learning network with Gluon

Now let’s see how succinctly we can express a convolutional neural network using gluon. You might be relieved to find out that this requires hardly any more code than logistic regression.

Start by importing the necessary Python modules.

from __future__ import print_function import numpy as np import mxnet as mx from mxnet import nd, autograd, gluon mx.random.seed(1)

Creating Katacoda Scenarios

Thanks for creating Katacoda scenarios. This tab is designed to help you as an author have quick access the information you need when creating scenarios.

This tab will not be visible to users.

Here are some useful links to get you started.

Running Katacoda Workshops

If you are planning to use Katacoda for workshops, please contact [email protected] to arrange capacity.

Debugging Scenarios

Below is the response from any background scripts run or files uploaded. This stream can aid debugging scenarios.

If you still need assistance, please contact [email protected]