Table Of Contents
Table Of Contents

mxnet.gluon.data.vision.datasets.MNIST

class mxnet.gluon.data.vision.datasets.MNIST(root='/var/lib/jenkins/.mxnet/datasets/mnist', train=True, transform=None)[source]

MNIST handwritten digits dataset from http://yann.lecun.com/exdb/mnist

Each sample is an image (in 3D NDArray) with shape (28, 28, 1).

Parameters
  • root (str, default $MXNET_HOME/datasets/mnist) – Path to temp folder for storing data.

  • train (bool, default True) – Whether to load the training or testing set.

  • transform (function, default None) –

    A user defined callback that transforms each sample. For example:

    transform=lambda data, label: (data.astype(np.float32)/255, label)
    

__init__(root='/var/lib/jenkins/.mxnet/datasets/mnist', train=True, transform=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([root, train, transform])

Initialize self.

transform(fn[, lazy])

Returns a new dataset with each sample transformed by the transformer function fn.

transform_first(fn[, lazy])

Returns a new dataset with the first element of each sample transformed by the transformer function fn.