<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSLossFunctionSoftmaxCrossEntropy",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@EA@BNNSLossFunction@BNNSLossFunctionSoftmaxCrossEntropy"
  },
  "title" : "BNNSLossFunctionSoftmaxCrossEntropy"
}
-->

# BNNSLossFunctionSoftmaxCrossEntropy

Softmax activation on input logits, and computation of cross-entropy loss with one-hot encoded labels.

```
var BNNSLossFunctionSoftmaxCrossEntropy: BNNSLossFunction { get }
```

## Discussion

[`BNNSLossFunctionSoftmaxCrossEntropy`](/documentation/Accelerate/BNNSLossFunctionSoftmaxCrossEntropy) performs softmax on input logits and computes cross entropy loss with one hot encoded labels.

You can smooth labels can according to smoothing factor.

You can scale the loss with either a scalar value or weight matrix, and reduce the loss according to a reduction function.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)