neural_network.input_data

Functions for downloading and reading MNIST data (deprecated).

This module and all its submodules are deprecated.

Attributes

DEFAULT_SOURCE_URL

Classes

_DataSet

Container class for a _DataSet (deprecated).

_Datasets

Functions

_dense_to_one_hot(labels_dense, num_classes)

Convert class labels from scalars to one-hot vectors.

_extract_images(f)

Extract the images into a 4D uint8 numpy array [index, y, x, depth].

_extract_labels(f[, one_hot, num_classes])

Extract the labels into a 1D uint8 numpy array [index].

_maybe_download(filename, work_directory, source_url)

Download the data from source url, unless it's already here.

_read32(bytestream)

read_data_sets(train_dir[, fake_data, one_hot, dtype, ...])

Module Contents

class neural_network.input_data._DataSet(images, labels, fake_data=False, one_hot=False, dtype=dtypes.float32, reshape=True, seed=None)

Container class for a _DataSet (deprecated).

THIS CLASS IS DEPRECATED.

next_batch(batch_size, fake_data=False, shuffle=True)

Return the next batch_size examples from this data set.

_epochs_completed = 0
_images
_index_in_epoch = 0
_labels
_rng
property epochs_completed
property images
property labels
property num_examples
class neural_network.input_data._Datasets

Bases: NamedTuple

test: _DataSet
train: _DataSet
validation: _DataSet
neural_network.input_data._dense_to_one_hot(labels_dense, num_classes)

Convert class labels from scalars to one-hot vectors.

neural_network.input_data._extract_images(f)

Extract the images into a 4D uint8 numpy array [index, y, x, depth].

Args:

f: A file object that can be passed into a gzip reader.

Returns:

data: A 4D uint8 numpy array [index, y, x, depth].

Raises:

ValueError: If the bytestream does not start with 2051.

neural_network.input_data._extract_labels(f, one_hot=False, num_classes=10)

Extract the labels into a 1D uint8 numpy array [index].

Args:

f: A file object that can be passed into a gzip reader. one_hot: Does one hot encoding for the result. num_classes: Number of classes for the one hot encoding.

Returns:

labels: a 1D uint8 numpy array.

Raises:

ValueError: If the bystream doesn’t start with 2049.

neural_network.input_data._maybe_download(filename, work_directory, source_url)

Download the data from source url, unless it’s already here.

Args:

filename: string, name of the file in the directory. work_directory: string, path to working directory. source_url: url to download from if file doesn’t exist.

Returns:

Path to resulting file.

neural_network.input_data._read32(bytestream)
neural_network.input_data.read_data_sets(train_dir, fake_data=False, one_hot=False, dtype=dtypes.float32, reshape=True, validation_size=5000, seed=None, source_url=DEFAULT_SOURCE_URL)
neural_network.input_data.DEFAULT_SOURCE_URL = 'https://storage.googleapis.com/cvdf-datasets/mnist/'