mlreco.models.layers.gnn.normalizations module

class mlreco.models.layers.gnn.normalizations.BatchNorm(in_channels, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)[source]

Bases: torch.nn.modules.batchnorm.BatchNorm1d

© Copyright 2020, Matthias Fey Revision 18da46c2.

Applies batch normalization over a batch of node features as described in the “Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift” paper

\[\mathbf{x}^{\prime}_i = \frac{\mathbf{x} - \textrm{E}[\mathbf{x}]}{\sqrt{\textrm{Var}[\mathbf{x}] + \epsilon}} \odot \gamma + \beta\]
Parameters
  • in_channels (int) – Size of each input sample.

  • eps (float, optional) – A value added to the denominator for numerical stability. (default: 1e-5)

  • momentum (float, optional) – The value used for the running mean and running variance computation. (default: 0.1)

  • affine (bool, optional) – If set to True, this module has learnable affine parameters \(\gamma\) and \(\beta\). (default: True)

  • track_running_stats (bool, optional) – If set to True, this module tracks the running mean and variance, and when set to False, this module does not track such statistics and always uses batch statistics in both training and eval modes. (default: True)

__init__(in_channels, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)[source]

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(x)[source]
__repr__()[source]

Return repr(self).

__module__ = 'mlreco.models.layers.gnn.normalizations'
num_features: int
eps: float
momentum: float
affine: bool
track_running_stats: bool
class mlreco.models.layers.gnn.normalizations.InstanceNorm(in_channels, eps=1e-05, momentum=0.1, affine=False, track_running_stats=False)[source]

Bases: torch.nn.modules.instancenorm._InstanceNorm

© Copyright 2020, Matthias Fey Revision 18da46c2.

Applies instance normalization over each individual example in a batch of node features as described in the “Instance Normalization: The Missing Ingredient for Fast Stylization” paper

\[\mathbf{x}^{\prime}_i = \frac{\mathbf{x} - \textrm{E}[\mathbf{x}]}{\sqrt{\textrm{Var}[\mathbf{x}] + \epsilon}} \odot \gamma + \beta\]
Parameters
  • in_channels (int) – Size of each input sample.

  • eps (float, optional) – A value added to the denominator for numerical stability. (default: 1e-5)

  • momentum (float, optional) – The value used for the running mean and running variance computation. (default: 0.1)

  • affine (bool, optional) – If set to True, this module has learnable affine parameters \(\gamma\) and \(\beta\). (default: False)

  • track_running_stats (bool, optional) – If set to True, this module tracks the running mean and variance, and when set to False, this module does not track such statistics and always uses instance statistics in both training and eval modes. (default: False)

__init__(in_channels, eps=1e-05, momentum=0.1, affine=False, track_running_stats=False)[source]

Initializes internal Module state, shared by both nn.Module and ScriptModule.

__module__ = 'mlreco.models.layers.gnn.normalizations'
forward(x, batch=None)[source]
num_features: int
eps: float
momentum: float
affine: bool
track_running_stats: bool