Menu
Apache MXNet on AWS
Developer Guide

Step 4: Run Sample Apache MXNet Code

Test your setup by writing simple MXNet code in Python and running it on the master node in the cluster. This code sample creates an array using the NDArray API and prints the array. For more information about this API, see NDArray API.

Run test code

  1. Start Python.

    Copy
    $ python

    In the following steps, >>> is the prompt for the Python terminal.

  2. Import MXNet.

    Copy
    >>> import mxnet as mx;
  3. Create a 5x5 matrix, an instance of the NDArray, with elements initialized to 0. Print the array.

    Copy
    >>> mx.ndarray.zeros((5,5)).asnumpy();
  4. Verify the result:

    array([[ 0.,  0.,  0.,  0.,  0.],
           [ 0.,  0.,  0.,  0.,  0.],
           [ 0.,  0.,  0.,  0.,  0.],
           [ 0.,  0.,  0.,  0.,  0.],
           [ 0.,  0.,  0.,  0.,  0.]], dtype=float32)
  5. Exit the Python terminal.

    Copy
    >>> exit()

Next Step

Step 5: Train a Sample Image Classification Model Using the Cluster