def ld_mnist(test_only=False):
 file_urls = ['http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz', 'http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz', 'http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz', 'http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz']
 local_urls = maybe_download(file_urls, FLAGS.data_dir)
 train_data = extract_mnist_data(local_urls[0], 60000, 28, 1)
 train_labels = extract_mnist_labels(local_urls[1], 60000)
 test_data = extract_mnist_data(local_urls[2], 10000, 28, 1)
 test_labels = extract_mnist_labels(local_urls[3], 10000)
 if test_only:
  return (test_data, test_labels)
 else:
  return (train_data, train_labels, test_data, test_labels)

def ld_mnist ( test_only = False ) : file_urls = [ 'http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz' , 'http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz' , 'http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz' , 'http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz' ] local_urls = maybe_download ( file_urls , FLAGS . data_dir ) train_data = extract_mnist_data ( local_urls [ 0 ] , 60000 , 28 , 1 ) train_labels = extract_mnist_labels ( local_urls [ 1 ] , 60000 ) test_data = extract_mnist_data ( local_urls [ 2 ] , 10000 , 28 , 1 ) test_labels = extract_mnist_labels ( local_urls [ 3 ] , 10000 ) if test_only : return ( test_data , test_labels ) else : return ( train_data , train_labels , test_data , test_labels )
load the mnist dataset .