diff options
author | Benoit Steiner <bsteiner@google.com> | 2017-02-08 09:25:09 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-02-08 09:50:05 -0800 |
commit | 639b4e71f532761a4840b1cdbaea55ad0917c75b (patch) | |
tree | 5116415b1d9ff82f054dd4feeadd81cb833d6435 /tensorflow/examples/udacity | |
parent | 15ff7b702788c0cf75bb8d5ce090f06490098cf7 (diff) |
Merge changes from github.
Change: 146918929
Diffstat (limited to 'tensorflow/examples/udacity')
-rw-r--r-- | tensorflow/examples/udacity/1_notmnist.ipynb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tensorflow/examples/udacity/1_notmnist.ipynb b/tensorflow/examples/udacity/1_notmnist.ipynb index c9ec86f71a..4b0a20b1dd 100644 --- a/tensorflow/examples/udacity/1_notmnist.ipynb +++ b/tensorflow/examples/udacity/1_notmnist.ipynb @@ -111,6 +111,7 @@ "source": [ "url = 'http://commondatastorage.googleapis.com/books1000/'\n", "last_percent_reported = None\n", + "data_root = '.' # Change me to store data elsewhere\n", "\n", "def download_progress_hook(count, blockSize, totalSize):\n", " \"\"\"A hook to report the progress of a download. This is mostly intended for users with\n", @@ -131,17 +132,18 @@ " \n", "def maybe_download(filename, expected_bytes, force=False):\n", " \"\"\"Download a file if not present, and make sure it's the right size.\"\"\"\n", - " if force or not os.path.exists(filename):\n", + " dest_filename = os.path.join(data_root, filename)\n", + " if force or not os.path.exists(dest_filename):\n", " print('Attempting to download:', filename) \n", - " filename, _ = urlretrieve(url + filename, filename, reporthook=download_progress_hook)\n", + " filename, _ = urlretrieve(url + filename, dest_filename, reporthook=download_progress_hook)\n", " print('\\nDownload Complete!')\n", - " statinfo = os.stat(filename)\n", + " statinfo = os.stat(dest_filename)\n", " if statinfo.st_size == expected_bytes:\n", - " print('Found and verified', filename)\n", + " print('Found and verified', dest_filename)\n", " else:\n", " raise Exception(\n", - " 'Failed to verify ' + filename + '. Can you get to it with a browser?')\n", - " return filename\n", + " 'Failed to verify ' + dest_filename + '. Can you get to it with a browser?')\n", + " return dest_filename\n", "\n", "train_filename = maybe_download('notMNIST_large.tar.gz', 247336696)\n", "test_filename = maybe_download('notMNIST_small.tar.gz', 8458043)" @@ -683,7 +685,7 @@ "cellView": "both" }, "source": [ - "pickle_file = 'notMNIST.pickle'\n", + "pickle_file = os.path.join(data_root, 'notMNIST.pickle')\n", "\n", "try:\n", " f = open(pickle_file, 'wb')\n", |