llSourcell / tensorflow_demo

Tensorflow Demo for my TF in 5 Min Video on Youtube
229 stars 175 forks source link

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

Open Surakshaajith opened 7 years ago

Surakshaajith commented 7 years ago

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 commented 7 years ago

Just created a Pull request to fix this bug: https://github.com/llSourcell/tensorflow_demo/pull/5

Surakshaajith commented 7 years ago

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 commented 7 years ago

Same issue .

rakis10 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

jarvis-owl commented 7 years ago

@rakis10 had the same problem.

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

These Attributes are deprecated Found: https://github.com/tensorflow/serving/issues/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 commented 7 years ago

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 commented 7 years ago

Can anyone help?