gammagl.layers.conv.MAGCLConv

class MAGCLConv(in_channels, out_channels, norm='both', add_bias=True)[source]

The graph convolutional operator from the “MA-GCL: Model Augmentation Tricks for Graph Contrastive Learning” paper

we focus on analyzing graph signals and assume one-hot node features \(\boldsymbol{X}=\boldsymbol{I},\) Then the embedding of two views can be written as \(\boldsymbol{Z}=\boldsymbol{U} \Lambda^{L} \boldsymbol{U}^{T} \boldsymbol{W}\) , \(\boldsymbol{Z'}=\boldsymbol{U} \Lambda^{L'} \boldsymbol{U}^{T} \boldsymbol{W}\), where \(\boldsymbol{W} \in \mathbb{R}^{|\mathcal{V}| \times d_{O}}\)

the loss is written as:

\[\min _{\boldsymbol{W}} = \sum_{i=1}^{|\mathcal{V}|}\left|\boldsymbol{z}_{i}-\boldsymbol{z}_{i}^{\prime}\right|^{2} = \min _{\boldsymbol{W}} \text{tr}\left(\left(\boldsymbol{Z}-\boldsymbol{Z}^{\prime}\right)\left(\boldsymbol{Z}-\boldsymbol{Z}^{\prime}\right)^{T}\right)\]

subject to \(\boldsymbol{W}^{T} \boldsymbol{W}=\boldsymbol{I}\).

Parameters:
  • in_channels (int) – Size of each input sample

  • out_channels (int) – Size of each output sample.

  • norm (str, optional) –

    How to apply the normalizer. Can be one of the following values:

    • right, to divide the aggregated messages by each node’s in-degrees, which is equivalent to averaging the received messages.

    • none, where no normalization is applied.

    • both (default), where the messages are scaled with \(1/c_{ji}\) above, equivalent to symmetric normalization.

    • left, to divide the messages sent out from each node by its out-degrees, equivalent to random walk normalization.

  • add_bias (bool, optional) – If set to False, the layer will not learn an additive bias. (default: True)

forward(x, edge_index, k, edge_weight=None, num_nodes=None)[source]