GroupNorm

class dragon.vm.torch.nn.GroupNorm(
  num_groups,
  num_channels,
  eps=1e-05,
  affine=True
)[source]

Apply the group normalization. [Wu & He, 2018].

The normalization is defined as:

\[y = \frac{x - \mathrm{E}[x]}{\sqrt{\mathrm{Var}[x] + \epsilon}} * \gamma + \beta \]

Examples:

m = torch.nn.GroupNorm(num_groups=2, num_channels=4)
x = torch.randn(2, 4)
y = m(x)

__init__

GroupNorm.__init__(
  num_groups,
  num_channels,
  eps=1e-05,
  affine=True
)[source]

Create a GroupNorm module.

Parameters:
  • num_groups (int) – The number of groups to split.
  • num_channels (int) – The number of channels.
  • eps (float, optional, default=1e-5) – The epsilon value.
  • affine (bool, optional, default=True) – True to apply a affine transformation.