<!--
{
  "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/BNNSLossFunctionCosineDistance",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@EA@BNNSLossFunction@BNNSLossFunctionCosineDistance"
  },
  "title" : "BNNSLossFunctionCosineDistance"
}
-->

# BNNSLossFunctionCosineDistance

Performs cosine distance loss computation between input predictions and labels.

```
var BNNSLossFunctionCosineDistance: BNNSLossFunction { get }
```

## Discussion

[`BNNSLossFunctionCosineDistance`](/documentation/Accelerate/BNNSLossFunctionCosineDistance) performs cosine distance loss computation between labels and predictions.

You must unit-normalize both labels and predictions before calculating loss.

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)