Reputation: 11
I'm trying to run the tutorial on Linux. I installed gcc
, cython
, numpy
, six
.
I can import the data but there seems to be some kind of problem unpacking it.
Can anyone help?
Python 2.7.3 (default, Jun 22 2015, 19:43:34)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import g3doc.tutorials.mnist.input_data as input_data
>>> mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Extracting MNIST_data/train-images-idx3-ubyte.gz
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "g3doc/tutorials/mnist/input_data.py", line 175, in read_data_sets
train_images = extract_images(local_file)
File "g3doc/tutorials/mnist/input_data.py", line 60, in extract_images
buf = bytestream.read(rows * cols * num_images)
File "/usr/lib/python2.7/gzip.py", line 263, in read
chunk = self.extrabuf[offset: offset + size]
TypeError: only integer scalar arrays can be converted to a scalar index
>>> mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
Extracting MNIST_data/train-images-idx3-ubyte.gz
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "g3doc/tutorials/mnist/input_data.py", line 175, in read_data_sets
train_images = extract_images(local_file)
File "g3doc/tutorials/mnist/input_data.py", line 60, in extract_images
buf = bytestream.read(rows * cols * num_images)
File "/usr/lib/python2.7/gzip.py", line 263, in read
chunk = self.extrabuf\[offset: offset + size]
TypeError: only integer scalar arrays can be converted to a scalar index
Upvotes: 1
Views: 10558
Reputation: 126194
This appears to be an issue with the latest version of Numpy. A recent change made it an error to treat a single-element array as a scalar for the purposes of indexing.
I have made the relevant change to the upstream TensorFlow code, but in the meantime you can edit this line in input_data.py
(L45) to be the following (adding [0]
at the end of the line):
return numpy.frombuffer(bytestream.read(4), dtype=dt)[0]
Upvotes: 9