torch_geometric.nn.norm.GraphNorm — pytorch_geometric documentation (original) (raw)

class GraphNorm(in_channels: int, eps: float = 1e-05)[source]

Bases: Module

Applies graph normalization over individual graphs as described in the“GraphNorm: A Principled Approach to Accelerating Graph Neural Network Training” paper.

\[\mathbf{x}^{\prime}_i = \frac{\mathbf{x} - \alpha \odot \textrm{E}[\mathbf{x}]} {\sqrt{\textrm{Var}[\mathbf{x} - \alpha \odot \textrm{E}[\mathbf{x}]] + \epsilon}} \odot \gamma + \beta\]

where \(\alpha\) denotes parameters that learn how much information to keep in the mean.

Parameters:

reset_parameters()[source]

Resets all learnable parameters of the module.

forward(x: Tensor, batch: Optional[Tensor] = None, batch_size: Optional[int] = None) → Tensor[source]

Forward pass.

Parameters:

Return type:

Tensor