Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: only integer scalar arrays can be converted to a scalar index #4

Open
Surakshaajith opened this issue Feb 9, 2017 · 9 comments

Comments

@Surakshaajith
Copy link

I am currently using python version 3.5.2
Z:\downloads\tensorflow_demo-master\tensorflow_demo-master>py
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

I get the following error when i run board.py and i have all the dependencies required to run board.py
Z:\downloads\tensorflow_demo-master\tensorflow_demo-master>py board.py
Extracting Z:/downloads/MNIST dataset\train-images-idx3-ubyte.gz
Traceback (most recent call last):
File "board.py", line 3, in
mnist = input_data.read_data_sets(r'Z:/downloads/MNIST dataset', one_hot=True)
File "Z:\downloads\tensorflow_demo-master\tensorflow_demo-master\input_data.py", line 150, in read_data_sets
train_images = extract_images(local_file)
File "Z:\downloads\tensorflow_demo-master\tensorflow_demo-master\input_data.py", line 40, in extract_images
buf = bytestream.read(rows * cols * num_images)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\gzip.py", line 274, in read
return self._buffer.read(size)
TypeError: only integer scalar arrays can be converted to a scalar index

@luciano-fiandesio
Copy link

Just created a Pull request to fix this bug: #5

@Surakshaajith
Copy link
Author

This worked out for me, instead of this line, i replaced it with these lines

from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)

@Ajinkya-wan
Copy link

Same issue .

@rakis10
Copy link

rakis10 commented Apr 12, 2017

Thank you for fix but now i am getting this error

  File "board.py", line 32, in <module>
    w_h = tf.histogram_summary("weights", W)
AttributeError: 'module' object has no attribute 'histogram_summary'

@SheldonGeek
Copy link

This will fix it. Add [0] to the end of this function in input_data.py
def _read32(bytestream):
dt = numpy.dtype(numpy.uint32).newbyteorder('>')
return numpy.frombuffer(bytestream.read(4), dtype=dt)[0]

@jimut
Copy link

jimut commented Apr 21, 2017

@SheldonGeek Thank you. Fixed this problem. Should make a PR.

@jarvis-owl
Copy link

@rakis10
had the same problem.

AttributeError: module 'tensorflow' has no attribute 'histogram_summary'

These Attributes are deprecated
Found: tensorflow/serving#270

changed board.py:
l.28 and l.29 >> histogram_summary to summary.histogram
l.37 >> scalar_summary to summary.scalar
l.47 >> merge_all_summaries to summary.merge_all
l.56 >> tf.train.SummaryWriter to tf.summary.FileWriter
here i still get a warning, that passing a 'GraphDef' is deprecated and passing a 'Graph' object is proposed. [Going to fix that later]

eventually helpful: tf API doc

@aster28
Copy link

aster28 commented Aug 12, 2017

sn.jointplot(x=x,y=y,kind='hex')
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\sonia\AppData\Local\Programs\Python\Python35\lib\site-packages\seaborn\axisgrid.py", line 2219, in jointplot
xlim=xlim, ylim=ylim)
File "C:\Users\sonia\AppData\Local\Programs\Python\Python35\lib\site-packages\seaborn\axisgrid.py", line 1671, in init
x = x[not_na]
TypeError: only integer scalar arrays can be converted to a scalar index

sn.jointplot(x,y,kind='hex')
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\sonia\AppData\Local\Programs\Python\Python35\lib\site-packages\seaborn\axisgrid.py", line 2219, in jointplot
xlim=xlim, ylim=ylim)
File "C:\Users\sonia\AppData\Local\Programs\Python\Python35\lib\site-packages\seaborn\axisgrid.py", line 1671, in init
x = x[not_na]
TypeError: only integer scalar arrays can be converted to a scalar index
sn.jointplot(x,y,kind='hex')
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\sonia\AppData\Local\Programs\Python\Python35\lib\site-packages\seaborn\axisgrid.py", line 2219, in jointplot
xlim=xlim, ylim=ylim)
File "C:\Users\sonia\AppData\Local\Programs\Python\Python35\lib\site-packages\seaborn\axisgrid.py", line 1671, in init
x = x[not_na]
TypeError: only integer scalar arrays can be converted to a scalar index

@aster28
Copy link

aster28 commented Aug 12, 2017

Can anyone help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants