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

Comments

Hotfix mnist sess run#85

Open
Atlas7 wants to merge 2 commits intochiphuyen:masterfrom
Atlas7:hotfix-mnist-sess-run
Open

Hotfix mnist sess run#85
Atlas7 wants to merge 2 commits intochiphuyen:masterfrom
Atlas7:hotfix-mnist-sess-run

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.

1 participant