braindecode.functional.masked_group_norm#
- braindecode.functional.masked_group_norm(x, num_groups, mask=None, weight=None, bias=None, eps=1e-05)[source]#
Group normalization with statistics over the entries a mask flags.
For a group norm whose statistics span several channels of a sample, so that padded channels do not shift those of the real ones.
- Parameters:
x (
Tensor) – Tensor of shape(batch, channels, ...), as fortorch.nn.functional.group_norm().num_groups (
int) – Number of groups the channels are split into.mask (
Optional[Tensor]) – Boolean mask over the batch and the leading axes after the channels (e.g.(batch, rows)forxof shape(batch, channels, rows, width)),Truefor the entries that enter the statistics; it is broadcast over the remaining axes.Noneistorch.nn.functional.group_norm().weight (
Optional[Tensor]) – Per-channel affine parameters, of shape(channels,).bias (
Optional[Tensor]) – Per-channel affine parameters, of shape(channels,).eps (
float) – Added to the variance for numerical stability.
- Returns:
xnormalized, same shape. Masked entries are zero, including after the affine transform, and receive zero input gradients. Their values (even NaN) affect neither the statistics nor the affine gradients.- Return type: