llSourcell / tensorflow_demo

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

Updated commands for latest Tensorflow version #2

Open EmCity opened 7 years ago

EmCity commented 7 years ago

Hey Siraj,

first of all I want to say I love your videos and your code! It's really helpful for getting into Machine Learning and Deep Learning in particular.

I updated some of the Tensorflow commands in that code (some warning will be issued when executing your current code with latest the Tensorflow version)

Cheers, Sebastian

jkronen commented 7 years ago

Thank you for this update. Now it's wokring with TF0.12.1 But I still have an issue with the eval-function.

Traceback (most recent call last): File "main.py", line 84, in <module> print "Accuracy:", accuracy.eval({x: mnist.test.images, y: mnist.test.labels}) File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 575, in eval return _eval_using_default_session(self, feed_dict, self.graph, session) File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3619, in _eval_using_default_session raise ValueError("Cannot evaluate tensor using eval(): No default " ValueError: Cannot evaluate tensor using eval(): No default session is registered. Use with sess.as_default() or pass an explicit session to eval(session=sess)

EmCity commented 7 years ago

Hi jkronen,

Are you running an interactive session?

Try passing session=sess to the eval function, e.g. print "Accuracy:", accuracy.eval(session=sess, {x: mnist.test.images, y: mnist.test.labels})

Good luck! Sebastian

jkronen commented 7 years ago

Hey Sebastian,

thank you for your reply. I am not running an interactive session. I just have the code from here with your updates and run it from the terminal.

Changing the line to your suggestion, produces following output:

print "Accuracy:", accuracy.eval(session=sess,{x: mnist.test.images, y: mnist.test.labels})
SyntaxError: non-keyword arg after keyword arg](url)

I even tried accuracy.eval(sess,{x: or setting the session as default, but none of them worked

Greetings Jan

EmCity commented 7 years ago

Hi Jan,

I'm sorry, I was a little careless, try this line:

print "Accuracy:", accuracy.eval(session=sess, feed_dict={x: mnist.test.images, y: mnist.test.labels})

If this throws an error, please report the whole error message.

Cheers, Sebastian

jkronen commented 7 years ago

There you go, it's working now. Thank you very much!

Greeting Jan