[吃药深度学习随笔] 交叉熵

#TensorFlow函数
ce = -tf.reduce_mean(y_* tf.log(tf.clip_by_value(y, 1e-12, 1.0)))

#Tensorflow代码
ce = tf.nn.sparse_softmax_cross_entropy_with_logits(logits=y, labels=tf.argmax(y_,1))

cem = tf.reduce_mean(ce)

猜你喜欢

转载自www.cnblogs.com/EatMedicine/p/9065286.html