softmax_cross_entropy_with_logits(labels,logits)
logitsand
labelsmust have the same shape
[batch_size, num_classes]and the same dtype (either
float16,
float32, or
float64`).
sparse_softmax_cross_entropy_with_logits(labels,logits)
A common use case is to have logits of shape [batch_size, num_classes]
and
labels of shape [batch_size]
应用sparse_softmax_cross_entropy_with_logits()作为交叉熵损失函数时,参数labels=[batch_size],logits=[batch_size,类的数量]。
每一个batch中,在logits的类中找最大的数据与label中对应的数据进行对比。