MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / maybe_download

Function maybe_download

tensorflow/input_data.py:11–20  ·  view source on GitHub ↗

Download the data from Yann's website, unless it's already here.

(filename, work_directory)

Source from the content-addressed store, hash-verified

9from six.moves import xrange # pylint: disable=redefined-builtin
10SOURCE_URL = 'http://yann.lecun.com/exdb/mnist/'
11def maybe_download(filename, work_directory):
12 """Download the data from Yann's website, unless it's already here."""
13 if not os.path.exists(work_directory):
14 os.mkdir(work_directory)
15 filepath = os.path.join(work_directory, filename)
16 if not os.path.exists(filepath):
17 filepath, _ = urllib.request.urlretrieve(SOURCE_URL + filename, filepath)
18 statinfo = os.stat(filepath)
19 print('Succesfully downloaded', filename, statinfo.st_size, 'bytes.')
20 return filepath
21def _read32(bytestream):
22 dt = numpy.dtype(numpy.uint32).newbyteorder('>')
23 return numpy.frombuffer(bytestream.read(4), dtype=dt)

Callers 1

read_data_setsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected