spamosaic.train_utils.graph_recon_crit

spamosaic.train_utils.graph_recon_crit(z, pos_edge_index)[source]

Compute binary cross-entropy loss for graph reconstruction using positive and negative edges.

Parameters:
  • z (torch.Tensor) – Node embeddings of shape [num_nodes, embedding_dim].

  • pos_edge_index (torch.Tensor) – Positive edge indices of shape [2, num_pos_edges].

Returns:

Scalar reconstruction loss combining positive and negative samples.

Return type:

torch.Tensor