(v_xs, v_ys)
| 24 | return outputs |
| 25 | |
| 26 | def compute_accuracy(v_xs, v_ys): |
| 27 | global prediction |
| 28 | y_pre = sess.run(prediction, feed_dict={xs: v_xs}) |
| 29 | correct_prediction = tf.equal(tf.argmax(y_pre,1), tf.argmax(v_ys,1)) |
| 30 | accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) |
| 31 | result = sess.run(accuracy, feed_dict={xs: v_xs, ys: v_ys}) |
| 32 | return result |
| 33 | |
| 34 | # define placeholder for inputs to network |
| 35 | xs = tf.placeholder(tf.float32, [None, 784]) # 28x28 |