else:
// negative KL-div has an additional log(num_classes) term but ignored
// here because it doesn"t contribute to optimization
log_probs = F.log_softmax(logits, dim=1) if self.from_logits else logits
label_smoothing_loss = -1 * log_probs.mean(dim=1)
if reduce:
After Change
// negative KL-div has an additional log(num_classes) term but ignored
// here because it doesn"t contribute to optimization
if self.source == SourceType.LOGITS:
log_probs = F.log_softmax(logits, dim=1)
elif self.source == SourceType.PROBS:
log_probs = logits.log()
else:
log_probs = logits