Skip to content
heliaEDGE
Reference
HELIA

normalization

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 for additional layers.

Machine-readable model

class

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

helia_edge/layers/normalization.py:23

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.

function

Layer normalization

helia_edge/layers/normalization.py:63

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 of layer_normalization
NameTypeDefaultDescription
namestr | NoneNoneLayer name. Defaults to None.
axisint | tuple[int] | NoneNoneAxis. Defaults to None.
scaleboolTrueScale. Defaults to True.
Returns of layer_normalization
TypeDescription
keras.Layerkeras.Layer: Layer
function

Batch normalization

helia_edge/layers/normalization.py:128

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

Batch normalization

Parameters of batch_normalization
NameTypeDefaultDescription
namestr | NoneNoneLayer name. Defaults to None.
momentumfloat0.9Momentum. Defaults to 0.9.
epsilonfloat0.001Epsilon. Defaults to 1e-3.
axisint | None-1Axis. Defaults to None.
Returns of batch_normalization
TypeDescription
keras.Layerkeras.Layer: Layer
function

Creates normalization layer based on type

helia_edge/layers/normalization.py:158

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

Creates normalization layer based on type

Parameters of normalization
NameTypeDefaultDescription
normstrRequiredNormalization type
namestrRequiredName
Returns of normalization
ValueTypeDescription
KerasLayerkeras.LayerLayer