tf.nn.sigmoid_cross_entropy_with_logits() 表示和sigmoid搭配使用的交叉熵
tf.nn.softmax_cross_entropy_with_logits() 表示和softmax搭配使用的交叉熵
这两种模型预测logit要经过sigmoid或者softmax,label要进行onehot
The predicted outputs.
The ground truth output tensor, same dimensions as ‘predictions’.
Coefficients for the loss a scalar, a tensor of shape [batch_size] or a tensor whose shape matches
The scope for the operations performed in computing the loss.
[batch_size, num_classes] logits outputs of the network .
[batch_size, 1] or [batch_size] labels of dtype
or
in the range
Coefficients for the loss. The tensor must be a scalar or a tensor of shape [batch_size] or [batch_size, 1].
the scope for the operations performed in computing the loss.
[batch_size, num_classes] logits outputs of the network .
[batch_size, num_classes] one-hot-encoded labels.
Coefficients for the loss. The tensor must be a scalar or a tensor of shape [batch_size].
If greater than 0 then smooth the labels.
the scope for the operations performed in computing the loss.
[batch_size, num_classes] logits outputs of the network .
[batch_size, num_classes] labels in (0, 1).
Coefficients for the loss. The tensor must be a scalar, a tensor of shape [batch_size] or shape [batch_size, num_classes].
If greater than 0 then smooth the labels.
The scope for the operations performed in computing the loss.
Original: https://blog.csdn.net/qq_42787229/article/details/124131243
Author: Solobboy
Title: tf1常用损失函数
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/521236/
转载文章受原作者版权保护。转载请注明原作者出处!