<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSGraph/Builder/Tensor/layerNorm(weight:bias:axes:epsilon:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate9BNNSGraphO7BuilderV6TensorV9layerNorm6weight4bias4axes7epsilonAGy__xGqd___qd_0_SaySiGSft7ElementQyd__RszAE18OperationParameterRd__AeQRd_0_AOQyd_0_APRSr0_lF"
  },
  "title" : "layerNorm(weight:bias:axes:epsilon:)"
}
-->

# layerNorm(weight:bias:axes:epsilon:)

Adds a layer normalization operation to the current graph.

```
func layerNorm(weight: some BNNSGraph.Builder.OperationParameter<T>, bias: some BNNSGraph.Builder.OperationParameter<T>, axes: [Int], epsilon: Float = .ulpOfOne.squareRoot()) -> BNNSGraph.Builder.Tensor<T>
```

## Parameters

`weight`

The weight values.

`bias`

The bias values.

`axes`

The axes over which the operation performs normalization.

`epsilon`

The epsilon value that the function uses to avoid division by zero.

## Discussion

This function performs layer normalization of `self` with an affine transform using `weight` and `bias`.

The shape of `weight` and `bias` must match the corresponding dimensions of `self` specified in `axes`.

---

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)