1 def compute_accuracy(v_xs, v_ys):
2     global prediction
3     y_pre = sess.run(prediction, feed_dict={xs: v_xs, keep_prob: 1})
4     correct_prediction = tf.equal(tf.argmax(y_pre,1), tf.argmax(v_ys,1))
5     accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
6     result = sess.run(accuracy, feed_dict={xs: v_xs, ys: v_ys, keep_prob: 1})
7     return result

 

相关文章:

  • 2022-12-23
  • 2021-10-03
  • 2021-07-27
  • 2022-12-23
  • 2021-12-27
  • 2021-11-11
  • 2021-08-01
猜你喜欢
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-14
  • 2022-12-23
相关资源
相似解决方案