code: def test_Uniform_NegativeSampler(negative_ratio):
      # Construct FusedCSCSamplingGraph.
      graph = gb_test_utils.rand_csc_graph(
          100, 0.05, bidirection_edge=True
      )
      num_seeds = 30
      item_set = gb.ItemSet(
          torch.arange(0, num_seeds * 2).reshape(-1, 2),
          names="node_pairs",
      )
      batch_size = 10
      item_sampler = gb.ItemSampler(item_set, batch_size=batch_size)
      # Construct NegativeSampler.
      negative_sampler = gb.UniformNegativeSampler(
          item_sampler,
          graph,
          negative_ratio,
      )
      # Perform Negative sampling.
      for data in negative_sampler:
          pos_src, pos_dst = data.node_pairs
          neg_src, neg_dst = data.negative_srcs, data.negative_dsts
          # Assertation
          assert len(pos_src) == batch_size
          assert len(pos_dst) == batch_size
          assert len(neg_dst) == batch_size
          assert neg_src is None
          assert neg_dst.numel() == batch_size * negative_ratio
  
file_path: dgl/tests/python/pytorch/graphbolt/impl/test_negative_sampler.py
imports: import dgl.graphbolt
  import pytest
  import torch
  from ..None import gb_test_utils
label_desc: Use image node_id 3 for calling a global function with example usage: test_Uniform_NegativeSampler(negative_ratio) without return types