MCPcopy
hub / github.com/MorvanZhou/tutorials / compute_accuracy

Function compute_accuracy

tensorflowTUT/tf18_CNN3/full_code.py:15–21  ·  view source on GitHub ↗
(v_xs, v_ys)

Source from the content-addressed store, hash-verified

13mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
14
15def compute_accuracy(v_xs, v_ys):
16 global prediction
17 y_pre = sess.run(prediction, feed_dict={xs: v_xs, keep_prob: 1})
18 correct_prediction = tf.equal(tf.argmax(y_pre,1), tf.argmax(v_ys,1))
19 accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
20 result = sess.run(accuracy, feed_dict={xs: v_xs, ys: v_ys, keep_prob: 1})
21 return result
22
23def weight_variable(shape):
24 initial = tf.truncated_normal(shape, stddev=0.1)

Callers 1

full_code.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected