pygod.nn.decoder#
- class pygod.nn.decoder.DotProductDecoder(in_dim, hid_dim=64, num_layers=1, dropout=0.0, act=<function relu>, sigmoid_s=False, backbone=<class 'torch_geometric.nn.models.basic_gnn.GCN'>, **kwargs)[source]#
Dot product decoder for the structure reconstruction, which is defined as \(\symbf{A}' = \sigma(\symbf{Z} \symbf{Z}^\intercal)\), where \(\sigma\) is the optional sigmoid function, \(\symbf{Z}\) is the input hidden embedding, and the \(\symbf{A}'\) is the reconstructed adjacency matrix.
- Parameters:
in_dim (int) – Input dimension of node features.
hid_dim (int, optional) – Hidden dimension of model. Default:
64
.num_layers (int, optional) – Number of layers in the decoder. Default:
1
.dropout (float, optional) – Dropout rate. Default:
0.
.act (callable activation function or None, optional) – Activation function if not None. Default:
torch.nn.functional.relu
.sigmoid_s (bool, optional) – Whether to apply sigmoid to the structure reconstruction. Default:
False
.backbone (torch.nn.Module, optional) – The backbone of the deep decoder implemented in PyG. Default:
torch_geometric.nn.GCN
.**kwargs (optional) – Additional arguments for the backbone.
- forward(x, edge_index)[source]#
Forward computation.
- Parameters:
x (torch.Tensor) – Input node embeddings.
edge_index (torch.Tensor) – Edge index.
- Returns:
s_ – Reconstructed adjacency matrix.
- Return type: