normalization
Normalization Layers API
This module provides classes to build normalization layers.
Functions:
-
layer_normalization
–Layer normalization
-
batch_normalization
–Batch normalization
-
normalization
–Normalization builder layer
Please check Keras Normalization Layers for additional layers.
Functions
layer_normalization
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
(str | None
, default:None
) –Layer name. Defaults to None.
-
axis
(int | tuple[int] | None
, default:None
) –Axis. Defaults to None.
-
scale
(bool
, default:True
) –Scale. Defaults to True.
Returns:
-
Layer
–keras.Layer: Layer
Source code in neuralspot_edge/layers/normalization.py
batch_normalization
batch_normalization(name: str | None = None, momentum=0.9, epsilon=0.001, axis: int | None = -1) -> keras.Layer
Batch normalization
Parameters:
-
name
(str | None
, default:None
) –Layer name. Defaults to None.
-
momentum
(float
, default:0.9
) –Momentum. Defaults to 0.9.
-
epsilon
(float
, default:0.001
) –Epsilon. Defaults to 1e-3.
-
axis
(int | None
, default:-1
) –Axis. Defaults to None.
Returns:
-
Layer
–keras.Layer: Layer
Source code in neuralspot_edge/layers/normalization.py
normalization
Creates normalization layer based on type
Parameters:
Returns:
-
KerasLayer
(Layer
) –Layer