Skip to main content

Python class

GroupNorm

GroupNorm

class max.nn.GroupNorm(num_groups, num_channels, eps=1e-05, affine=True, device=gpu:0)

source

Bases: Module

Group normalization block.

This layer divides channels into groups and computes normalization statistics per group.

When called, GroupNorm accepts a TensorValue of shape (N, C, *) where C is the number of channels. Then, it returns a normalized TensorValue of the same shape.

Parameters:

  • num_groups (int) – The number of groups to divide the channels into.
  • num_channels (int) – The number of input channels.
  • eps (float) – A small value added to the denominator for numerical stability.
  • affine (bool) – Whether to apply a learnable affine transformation after normalization.
  • device (DeviceRef) – The target DeviceRef for computation.