Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Hotfix mnist sess run #85

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Atlas7
Copy link

@Atlas7 Atlas7 commented Jan 3, 2018

The current example MNIST code has this line in it:

accuracy_batch = sess.run([accuracy], feed_dict={X: X_batch, Y:Y_batch})

This gives error (attempting to add a list to an int):

---> 33     total_correct_preds += accuracy_batch
     34   print('Accuracy {0}'.format(total_correct_preds/mnist.test.num_examples))
     35

TypeError: unsupported operand type(s) for +: 'int' and 'list'

This hotfix fixes it, by ensuring we are parsing a tensor object (instead of a list of 1 tensor object). i.e.

accuracy_batch = sess.run(accuracy, ...)

Note: Parsing a list is only appropriate when we are parsing multiple tensor objects. i.e. the following would work (and produce no error):

accuracy_batch_a, accuracy_batch_b = sess.run([accuracy, accuracy], ...)

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

Successfully merging this pull request may close these issues.

None yet

1 participant