softmax 交叉熵 return 值

softmax cross entropy return value

如果这是 tf.losses.softmax_cross_entropy_loss 的 return 值,这意味着什么?

<tf.Tensor 'softmax_cross_entropy_loss/value:0' shape=() dtype=float32>

状态 value:0 的事实是否意味着 shape=() 意味着什么都没有计算?

没有计算任何内容,因为您在图表中显示张量之前没有任何数据通过它们。比方说

sce = tf.losses.softmax_cross_entropy_loss(input)

然后要实际获得损失值,您必须使用

将数据输入其中
sess = tf.Session()
...
loss = sess.run(sce, feed_dict)

其中 feed_dict 是您的数据的字典。损失现在 return 实际数值损失值。

value 只是该值所属的计算组的一个指标。例如:tf.reduce_mean returns tf.Tensor 'Mean_1:0' shape=() dtype=float32 因为是均值计算。 0不表示当前值为0,只是用来做索引。

此外,您的张量形状是 (),因为单个损失值没有批量大小、x 或 y 方向或通道(假设您使用的是 4D 张量),所以这也可以.