code: def test_bipartite_batched_negative_sampling():
      edge_index1 = torch.as_tensor([[0, 0, 1, 1], [0, 1, 2, 3]])
      edge_index2 = edge_index1 + torch.tensor([[2], [4]])
      edge_index3 = edge_index2 + torch.tensor([[2], [4]])
      edge_index = torch.cat(
          [edge_index1, edge_index2, edge_index3], dim=1
      )
      src_batch = torch.tensor([0, 0, 1, 1, 2, 2])
      dst_batch = torch.tensor([0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2])
  
      neg_edge_index = batched_negative_sampling(
          edge_index, (src_batch, dst_batch)
      )
      assert neg_edge_index.size(1) <= edge_index.size(1)
  
      adj = torch.zeros(6, 12, dtype=torch.bool)
      adj[edge_index[0], edge_index[1]] = True
      neg_adj = torch.zeros(6, 12, dtype=torch.bool)
      neg_adj[neg_edge_index[0], neg_edge_index[1]] = True
  
      assert (adj & neg_adj).sum() == 0
      assert (adj | neg_adj).sum() == edge_index.size(
          1
      ) + neg_edge_index.size(1)
  
file_path: pytorch_geometric/test/utils/test_negative_sampling.py
imports: import torch
  from torch_geometric.utils import batched_negative_sampling, contains_self_loops, is_undirected, negative_sampling, structured_negative_sampling, structured_negative_sampling_feasible, to_undirected
  from torch_geometric.utils._negative_sampling import edge_index_to_vector, vector_to_edge_index
label_desc: Use image node_id 6 for calling a global function with example usage: test_bipartite_batched_negative_sampling() without return types