torch_geometric.nn.models.InnerProductDecoder

class InnerProductDecoder[source]

Bases: Module

The inner product decoder from the “Variational Graph Auto-Encoders” paper.

\[\sigma(\mathbf{Z}\mathbf{Z}^{\top})\]

where \(\mathbf{Z} \in \mathbb{R}^{N \times d}\) denotes the latent space produced by the encoder.

forward(z: Tensor, edge_index: Tensor, sigmoid: bool = True) Tensor[source]

Decodes the latent variables z into edge probabilities for the given node-pairs edge_index.

Parameters:
  • z (torch.Tensor) – The latent space \(\mathbf{Z}\).

  • edge_index (torch.Tensor) – The edge indices.

  • sigmoid (bool, optional) – If set to False, does not apply the logistic sigmoid function to the output. (default: True)

forward_all(z: Tensor, sigmoid: bool = True) Tensor[source]

Decodes the latent variables z into a probabilistic dense adjacency matrix.

Parameters:
  • z (torch.Tensor) – The latent space \(\mathbf{Z}\).

  • sigmoid (bool, optional) – If set to False, does not apply the logistic sigmoid function to the output. (default: True)