---
title: "layerNorm(weight:bias:axes:epsilon:)"
framework: accelerate
role: symbol
role_heading: Instance Method
path: "accelerate/bnnsgraph/builder/tensor/layernorm(weight:bias:axes:epsilon:)"
---

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

Adds a layer normalization operation to the current graph.

## Declaration

```swift
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

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.
