function softmaxCrossEntropy_(onehotLabels, logits, weights, labelSmoothing = 0, reduction = (0, _lossOpsUtils.Reduction).SUM_BY_NONZERO_WEIGHTS) {
    let $onehotLabels = (0, _tensorUtilEnv.convertToTensor)(onehotLabels, "onehotLabels", "softmaxCrossEntropy");
    const $logits = (0, _tensorUtilEnv.convertToTensor)(logits, "logits", "softmaxCrossEntropy");
    let $weights = null;
    if (weights != null) $weights = (0, _tensorUtilEnv.convertToTensor)(weights, "weights", "softmaxCrossEntropy");
    (0, _util.assertShapesMatch)($onehotLabels.shape, $logits.shape, "Error in softmaxCrossEntropy: ");
    if (labelSmoothing > 0) {
        const labelSmoothingScalar = (0, _scalar.scalar)(labelSmoothing);
        const one = (0, _scalar.scalar)(1);
        const numClasses = (0, _scalar.scalar)($onehotLabels.shape[1]);
        $onehotLabels = (0, _add.add)((0, _mul.mul)($onehotLabels, (0, _sub.sub)(one, labelSmoothingScalar)), (0, _div.div)(labelSmoothingScalar, numClasses));
    }
    const losses = softmaxCrossEntropyWithLogits_($onehotLabels, $logits);
    return (0, _computeWeightedLoss.computeWeightedLoss)(losses, $weights, reduction);
}
Computes the softmax cross entropy loss between two tensors.

If labelSmoothing is nonzero, smooth the labels towards 1/2:

  newOnehotLabels = onehotLabels * (1 - labelSmoothing)
                        + labelSmoothing / numClasses

@param onehotLabels One hot encoded labels
   [batch_size, num_classes], same dimensions as 'predictions'.
@param logits The predicted outputs.
@param weights Tensor whose rank is either 0, or 1, and must be
   broadcastable to `loss`  of shape [batch_size]
@param labelSmoothing If greater than 0, then smooth the labels.
@param reduction Type of reduction to apply to loss. Should be of type
   `Reduction`

@doc { heading: 'Training', subheading: 'Losses', namespace: 'losses' }