GINConv

class dhg.nn.GINConv(*args, **kwargs)[source]

Bases: torch.nn.Module

The GIN convolution layer proposed in How Powerful are Graph Neural Networks? paper (ICLR 2019).

Sparse Format:

\[\mathbf{x}^{\prime}_i = MLP \left( (1 + \epsilon) \cdot \mathbf{x}_i + \sum_{j \in \mathcal{N}(i)} \mathbf{x}_j \right).\]

Matrix Format:

\[\mathbf{X}^{\prime} = MLP \left( \left( \mathbf{A} + (1 + \epsilon) \cdot \mathbf{I} \right) \cdot \mathbf{X} \right).\]
Parameters
  • MLP (nn.Module) – The neural network to be applied after message passing, i.e. nn.Linear, nn.Sequential.

  • eps (float) – The epsilon value.

  • train_eps (bool) – If set to True, the epsilon value will be trainable.

forward(X, g)[source]

The forward function.

Parameters
  • X (torch.Tensor) – Input vertex feature matrix. Size \((N_v, C_{in})\).

  • g (dhg.Graph) – The graph structure that contains \(N_v\) vertices.