HeteroBatchNormalization
¶
HeteroBatchNormalization(
in_channels: int,
num_types: int,
eps: float = 1e-05,
momentum: Optional[float] = 0.1,
affine: bool = True,
track_running_stats: bool = True,
)
Bases: Module
Applies batch normalization over a batch of heterogeneous features, as described in the "Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift" paper.
Compared to a standard batch norm, HeteroBatchNorm applies
normalization individually for each node or edge type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_channels
|
int
|
Size of each input sample. |
required |
num_types
|
int
|
The number of types. |
required |
eps
|
float
|
A value added to the denominator for
numerical stability. (default: |
1e-05
|
momentum
|
float
|
The value used for the running mean and
running variance computation. If set to |
0.1
|
affine
|
bool
|
If set to |
True
|
track_running_stats
|
bool
|
If set to |
True
|
Methods:
| Name | Description |
|---|---|
reset_running_stats |
Resets all running statistics of the module. |
reset_parameters |
Resets all learnable parameters of the module. |
__call__ |
Forward pass. |
Source code in mlx_graphs/nn/norm/batch_norm.py
reset_running_stats
¶
Resets all running statistics of the module.
Source code in mlx_graphs/nn/norm/batch_norm.py
reset_parameters
¶
Resets all learnable parameters of the module.
__call__
¶
Forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
array
|
The input features of shape
|
required |
type_vec
|
array
|
An integer vector of shape
|
required |
Source code in mlx_graphs/nn/norm/batch_norm.py
from mlx_graphs.nn import HeteroBatchNormalization · mlx_graphs/nn/norm/batch_norm.py