code: def test_infomax_predefined_model(device):
      def corruption(x, edge_index, edge_weight):
          return (
              x[torch.randperm(x.size(0), device=x.device)],
              edge_index,
              edge_weight,
          )
  
      model = DeepGraphInfomax(
          hidden_channels=16,
          encoder=GCN(16, 16, num_layers=2),
          summary=lambda z, *args, **kwargs: z.mean(dim=0).sigmoid(),
          corruption=corruption,
      ).to(device)
  
      x = torch.randn(4, 16, device=device)
      edge_index = torch.tensor(
          [[0, 0, 0, 1, 2, 3], [1, 2, 3, 0, 0, 0]],
          device=device,
      )
      edge_weight = torch.rand(edge_index.size(1), device=device)
  
      pos_z, neg_z, summary = model(
          x, edge_index, edge_weight=edge_weight
      )
      assert pos_z.size() == (4, 16)
      assert neg_z.size() == (4, 16)
      assert summary.size() == (16,)
  
      loss = model.loss(pos_z, neg_z, summary)
      assert float(loss) >= 0
  
imports: import torch
  from torch_geometric.nn import GCN, DeepGraphInfomax
  from torch_geometric.testing import is_full_test, withCUDA
label_desc: Use image node_id 2 for calling a global function with example usage: test_infomax_predefined_model(device) and returns: x,  edge_index,  edge_weight