Unverified Commit 2b4f7b44 authored by Qianli Scott Zhu's avatar Qianli Scott Zhu Committed by GitHub
Browse files

Allow mnist data to be writen to remote file system. (#3890)

parent 77d3bbef
...@@ -70,7 +70,8 @@ def download(directory, filename): ...@@ -70,7 +70,8 @@ def download(directory, filename):
zipped_filepath = filepath + '.gz' zipped_filepath = filepath + '.gz'
print('Downloading %s to %s' % (url, zipped_filepath)) print('Downloading %s to %s' % (url, zipped_filepath))
urllib.request.urlretrieve(url, zipped_filepath) urllib.request.urlretrieve(url, zipped_filepath)
with gzip.open(zipped_filepath, 'rb') as f_in, open(filepath, 'wb') as f_out: with gzip.open(zipped_filepath, 'rb') as f_in, \
tf.gfile.Open(filepath, 'wb') as f_out:
shutil.copyfileobj(f_in, f_out) shutil.copyfileobj(f_in, f_out)
os.remove(zipped_filepath) os.remove(zipped_filepath)
return filepath return filepath
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment