torch_geometric.nn.models.VGAE

class VGAE(encoder: Module, decoder: Optional[Module] = None)[source]

Bases: GAE

The Variational Graph Auto-Encoder model from the “Variational Graph Auto-Encoders” paper.

Parameters:
forward(*args, **kwargs) Tensor

Alias for encode().

Return type:

Tensor

reset_parameters()

Resets all learnable parameters of the module.

kl_loss(mu: Optional[Tensor] = None, logstd: Optional[Tensor] = None) Tensor[source]

Computes the KL loss, either for the passed arguments mu and logstd, or based on latent variables from last encoding.

Parameters:
  • mu (torch.Tensor, optional) – The latent space for \(\mu\). If set to None, uses the last computation of \(\mu\). (default: None)

  • logstd (torch.Tensor, optional) – The latent space for \(\log\sigma\). If set to None, uses the last computation of \(\log\sigma^2\). (default: None)

Return type:

Tensor