tools.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:My-TensorFlow-tutorials 作者: kevin28520 项目源码 文件源码
def accuracy(logits, labels):
  """Evaluate the quality of the logits at predicting the label.
  Args:
    logits: Logits tensor, float - [batch_size, NUM_CLASSES].
    labels: Labels tensor, 
  """
  with tf.name_scope('accuracy') as scope:
      correct = tf.equal(tf.arg_max(logits, 1), tf.arg_max(labels, 1))
      correct = tf.cast(correct, tf.float32)
      accuracy = tf.reduce_mean(correct)*100.0
      tf.summary.scalar(scope+'/accuracy', accuracy)
  return accuracy



#%%
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号