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

# BNNSLossReductionNonZeroWeightMean

Sums the loss of all samples in the batch and divides by the number of non-zero weights.

```
var BNNSLossReductionNonZeroWeightMean: BNNSLossReductionFunction { get }
```

## Discussion

[`BNNSLossReductionNonZeroWeightMean`](/documentation/Accelerate/BNNSLossReductionNonZeroWeightMean) sums the loss of all samples in the batch and divides by number of non-zero weights.

Non-zero weighted mean reduction returns 0 in case all weights are zero.

---

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)