# helia_edge.layers.normalization

## Normalization Layers API

This module provides classes to build normalization layers.

**Classes**

| Name | Description |
| --- | --- |
| `LayerNormalization` | Keras layer normalization that also runs on the Torch backend for any axes |

**Functions**

| Name | Description |
| --- | --- |
| `layer_normalization` | Layer normalization |
| `batch_normalization` | Batch normalization |
| `normalization` | Normalization builder layer |

Please check [Keras Normalization Layers](https://keras.io/api/layers/normalization_layers/) for additional layers.

## helia_edge.layers.normalization.LayerNormalization

`class` · `python`

```python
LayerNormalization()
```

Keras ``LayerNormalization`` that also normalizes non-trailing axes on the Torch backend.

Keras 3's Torch backend normalizes trailing axes only, so axes such as ``(1, 2)`` of a
``(batch, height, width, channels)`` input fail there. On Torch, this layer moves the
normalized axes last, normalizes and moves them back. On other backends it is the Keras layer,
with the same weights, configuration and graph.

Saved models record this class as ``helia_edge>LayerNormalization``: load them with
``helia_edge.models.load_model``, or call ``helia_edge.register_keras_serializables()`` before
``keras.saving.load_model``.

Source: `helia_edge/layers/normalization.py:23`

### helia_edge.layers.normalization.LayerNormalization.call

`method` · `python`

```python
call(inputs)
```

Source: `helia_edge/layers/normalization.py:37`

## helia_edge.layers.normalization.layer_normalization

`function` · `python`

```python
layer_normalization(name: str | None = None, axis: int | tuple[int] | None = None, scale: bool = True) -> keras.Layer
```

Layer normalization

If axis is None, this layer will infer based on the input tensor shape:

* If rank is 4 (B, H, W, C), normalize over H, W
* If rank is 3 (B, T, C), normalize over T
* If rank is 2 (B, C), normalize over C

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| name | str \| None | None | Layer name. Defaults to None. |
| axis | int \| tuple[int] \| None | None | Axis. Defaults to None. |
| scale | bool | True | Scale. Defaults to True. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | keras.Layer | keras.Layer: Layer |

Source: `helia_edge/layers/normalization.py:63`

## helia_edge.layers.normalization.batch_normalization

`function` · `python`

```python
batch_normalization(name: str | None = None, momentum=0.9, epsilon=0.001, axis: int | None = -1) -> keras.Layer
```

Batch normalization

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| name | str \| None | None | Layer name. Defaults to None. |
| momentum | float | 0.9 | Momentum. Defaults to 0.9. |
| epsilon | float | 0.001 | Epsilon. Defaults to 1e-3. |
| axis | int \| None | -1 | Axis. Defaults to None. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | keras.Layer | keras.Layer: Layer |

Source: `helia_edge/layers/normalization.py:128`

## helia_edge.layers.normalization.normalization

`function` · `python`

```python
normalization(norm: str, name: str, **kwargs={}) -> keras.Layer
```

Creates normalization layer based on type

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| norm | str | Required | Normalization type |
| name | str | Required | Name |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
| KerasLayer | keras.Layer | Layer |

Source: `helia_edge/layers/normalization.py:158`
