Module Import alias Import alias Import alias Import alias Import alias ImportFrom alias alias Assign NameStore Num Assign NameStore Num Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore ListLoad NameLoad NameLoad NameLoad NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str If UnaryOpNot NameLoad body If NameLoad body Assign NameStore Call AttributeLoad Str attr NameLoad orelse Assign NameStore Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore TupleLoad TupleLoad Str Str NameLoad TupleLoad Str Str NameLoad TupleLoad Str Str NameLoad TupleLoad Str Str NameLoad Expr Call NameLoad NameLoad NameLoad Assign AttributeStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Str attr Index Num attr Str Assign AttributeStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Str attr Index Num attr Str Assign AttributeStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Str attr Index Num attr Str Assign AttributeStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Str attr Index Num attr Str Assign AttributeStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Str attr Index Num attr Str Assign AttributeStore SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Str attr Index Num attr Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Return TupleLoad NameLoad decorator_list Call NameLoad keyword NameLoad FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Str keyword BinOpAdd Str Str keyword TupleLoad Str Str Str keyword NameLoad keyword NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str With Call AttributeLoad NameLoad attr NameLoad Str NameStore body Assign TupleStore NameStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Num If CompareNotEq NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr keyword Str Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad Num NameLoad NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareEq AttributeLoad NameLoad attr Str body Assign NameStore CompareGtE NameLoad Num orelse If CompareEq AttributeLoad NameLoad attr Str body Assign NameStore Call AttributeLoad NameLoad attr NameLoad AugAssignDiv NameStore Num orelse Raise Call NameLoad Str Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str With Call AttributeLoad NameLoad attr NameLoad Str NameStore body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Num If CompareNotEq NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr keyword Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num Return NameLoad decorator_list
N/A N/A gzip N/A os N/A struct N/A h5py N/A numpy fuel.converters.base fill_hdf5_file check_exists N/A MNIST_IMAGE_MAGIC 2051 N/A MNIST_LABEL_MAGIC 2049 N/A TRAIN_IMAGES train-images-idx3-ubyte.gz N/A TRAIN_LABELS train-labels-idx1-ubyte.gz N/A TEST_IMAGES t10k-images-idx3-ubyte.gz N/A TEST_LABELS t10k-labels-idx1-ubyte.gz N/A ALL_FILES N/A TRAIN_IMAGES TRAIN_LABELS TEST_IMAGES TEST_LABELS convert_mnist N/A N/A directory output_directory output_filename dtype N/A None None N/A N/A Converts the MNIST dataset to HDF5.

    Converts the MNIST dataset to an HDF5 dataset compatible with
    :class:`fuel.datasets.MNIST`. The converted dataset is
    saved as 'mnist.hdf5'.

    This method assumes the existence of the following files:
    `train-images-idx3-ubyte.gz`, `train-labels-idx1-ubyte.gz`
    `t10k-images-idx3-ubyte.gz`, `t10k-labels-idx1-ubyte.gz`

    It assumes the existence of the following files:

    * `train-images-idx3-ubyte.gz`
    * `train-labels-idx1-ubyte.gz`
    * `t10k-images-idx3-ubyte.gz`
    * `t10k-labels-idx1-ubyte.gz`

    Parameters
    ----------
    directory : str
        Directory in which input files reside.
    output_directory : str
        Directory in which to save the converted dataset.
    output_filename : str, optional
        Name of the saved dataset. Defaults to `None`, in which case a name
        based on `dtype` will be used.
    dtype : str, optional
        Either 'float32', 'float64', or 'bool'. Defaults to `None`,
        in which case images will be returned in their original
        unsigned byte format.

    Returns
    -------
    output_paths : tuple of str
        Single-element tuple containing the path to the converted dataset.

     N/A N/A output_filename N/A N/A dtype N/A N/A output_filename N/A N/A mnist_{}.hdf5 format dtype N/A N/A output_filename mnist.hdf5 N/A output_path N/A N/A N/A os path join output_directory output_filename N/A h5file N/A N/A h5py File output_path mode w N/A train_feat_path N/A N/A N/A os path join directory TRAIN_IMAGES N/A train_features N/A read_mnist_images train_feat_path dtype N/A train_lab_path N/A N/A N/A os path join directory TRAIN_LABELS N/A train_labels N/A read_mnist_labels train_lab_path N/A test_feat_path N/A N/A N/A os path join directory TEST_IMAGES N/A test_features N/A read_mnist_images test_feat_path dtype N/A test_lab_path N/A N/A N/A os path join directory TEST_LABELS N/A test_labels N/A read_mnist_labels test_lab_path N/A data N/A N/A train features train_features N/A train targets train_labels N/A test features test_features N/A test targets test_labels N/A N/A fill_hdf5_file h5file data N/A N/A N/A N/A N/A h5file N/A features dims N/A 0 label batch N/A N/A N/A N/A N/A h5file N/A features dims N/A 1 label channel N/A N/A N/A N/A N/A h5file N/A features dims N/A 2 label height N/A N/A N/A N/A N/A h5file N/A features dims N/A 3 label width N/A N/A N/A N/A N/A h5file N/A targets dims N/A 0 label batch N/A N/A N/A N/A N/A h5file N/A targets dims N/A 1 label index N/A N/A N/A h5file flush N/A N/A N/A h5file close N/A N/A output_path N/A N/A check_exists required_files ALL_FILES fill_subparser N/A N/A subparser N/A N/A N/A Sets up a subparser to convert the MNIST dataset files.

    Parameters
    ----------
    subparser : :class:`argparse.ArgumentParser`
        Subparser handling the `mnist` command.

     N/A N/A N/A subparser add_argument --dtype help N/A dtype to save to; by default, images will be  returned in their original unsigned byte format choices N/A float32 float64 bool type str default None N/A convert_mnist N/A read_mnist_images N/A N/A filename dtype N/A None N/A N/A Read MNIST images from the original ubyte file format.

    Parameters
    ----------
    filename : str
        Filename/path from which to read images.

    dtype : 'float32', 'float64', or 'bool'
        If unspecified, images will be returned in their original
        unsigned byte format.

    Returns
    -------
    images : :class:`~numpy.ndarray`, shape (n_images, 1, n_rows, n_cols)
        An image array, with individual examples indexed along the
        first axis and the image dimensions along the second and
        third axis.

    Notes
    -----
    If the dtype provided was Boolean, the resulting array will
    be Boolean with `True` if the corresponding pixel had a value
    greater than or equal to 128, `False` otherwise.

    If the dtype provided was a float dtype, the values will be mapped to
    the unit interval [0, 1], with pixel values that were 255 in the
    original unsigned byte representation equal to 1.0.

     N/A N/A N/A gzip open filename rb f N/A N/A N/A magic number rows cols N/A N/A struct unpack >iiii N/A N/A f read 16 N/A N/A magic MNIST_IMAGE_MAGIC N/A N/A N/A ValueError Wrong magic number reading MNIST image file N/A array N/A N/A numpy frombuffer N/A N/A f read dtype uint8 N/A array N/A N/A array reshape N/A number 1 rows cols N/A dtype N/A N/A dtype N/A N/A numpy dtype dtype N/A N/A N/A dtype kind b N/A N/A array N/A array 128 N/A N/A N/A N/A dtype kind f N/A N/A array N/A N/A array astype dtype N/A array 255.0 N/A N/A N/A ValueError Unknown dtype to convert MNIST to N/A array N/A read_mnist_labels N/A N/A filename N/A N/A N/A Read MNIST labels from the original ubyte file format.

    Parameters
    ----------
    filename : str
        Filename/path from which to read labels.

    Returns
    -------
    labels : :class:`~numpy.ndarray`, shape (nlabels, 1)
        A one-dimensional unsigned byte array containing the
        labels as integers.

     N/A N/A N/A gzip open filename rb f N/A N/A N/A magic _ N/A N/A struct unpack >ii N/A N/A f read 8 N/A N/A magic MNIST_LABEL_MAGIC N/A N/A N/A ValueError Wrong magic number reading MNIST label file N/A array N/A N/A numpy frombuffer N/A N/A f read dtype uint8 N/A array N/A N/A array reshape N/A array size 1 N/A array N/A