Skip to content

Commit 99813c2

Browse files
author
Vijay Vasudevan
committed
Merge pull request tensorflow#1170 from danijar/python-3-mnist-encoding.
2 parents 30628d6 + 555e73d commit 99813c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tensorflow/examples/tutorials/mnist/input_data.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _read32(bytestream):
5454
def extract_images(filename):
5555
"""Extract the images into a 4D uint8 numpy array [index, y, x, depth]."""
5656
print('Extracting', filename)
57-
with tf.gfile.Open(filename) as f, gzip.GzipFile(fileobj=f) as bytestream:
57+
with tf.gfile.Open(filename, 'rb') as f, gzip.GzipFile(fileobj=f) as bytestream:
5858
magic = _read32(bytestream)
5959
if magic != 2051:
6060
raise ValueError(
@@ -81,7 +81,7 @@ def dense_to_one_hot(labels_dense, num_classes):
8181
def extract_labels(filename, one_hot=False, num_classes=10):
8282
"""Extract the labels into a 1D uint8 numpy array [index]."""
8383
print('Extracting', filename)
84-
with tf.gfile.Open(filename) as f, gzip.GzipFile(fileobj=f) as bytestream:
84+
with tf.gfile.Open(filename, 'rb') as f, gzip.GzipFile(fileobj=f) as bytestream:
8585
magic = _read32(bytestream)
8686
if magic != 2049:
8787
raise ValueError(

0 commit comments

Comments
 (0)