笔记 - 损失函数:交叉熵
import tensorflow as tf
"""
给出n个样本的预测值与真实值进行计算交叉熵(label已进行热编码)
即两个矩阵
交叉熵公式倒背如流
"""
y = tf.constant([[0, 0, 1], [1, 0, 0]], dtype=tf.float32)
y_pred = tf.random_uniform(shape=(2, 3), minval=0, maxval...
原创
2019-05-11 07:49:08 ·
388 阅读 ·
0 评论