2
通常做法是将批次的平均损失而不是总和减到最小?
Tensorflow有一个有关对CIFAR-10进行分类的示例教程。在本教程中,批次中的平均交叉熵损失最小。 def loss(logits, labels): """Add L2Loss to all the trainable variables. Add summary for for "Loss" and "Loss/avg". Args: logits: Logits from inference(). labels: Labels from distorted_inputs or inputs(). 1-D tensor of shape [batch_size] Returns: Loss tensor of type float. """ # Calculate the average cross entropy loss across the …