code: def test_sample_neighbors_replace(
      replace, expected_sampled_num1, expected_sampled_num2
  ):
      if F._default_context_str == "gpu" and replace == True:
          pytest.skip(
              "Sampling with replacement not yet supported on GPU."
          )
      """Original graph in COO:
      "n1:e1:n2":[0, 0, 1, 1, 1], [0, 2, 0, 1, 2]
      "n2:e2:n1":[0, 0, 1, 2], [0, 1, 1 ,0]
      0   0   1   0   1
      0   0   1   1   1
      1   1   0   0   0
      0   1   0   0   0
      1   0   0   0   0
      """
      # Initialize data.
      ntypes = {"n1": 0, "n2": 1}
      etypes = {"n1:e1:n2": 0, "n2:e2:n1": 1}
      total_num_edges = 9
      indptr = torch.LongTensor([0, 2, 4, 6, 7, 9])
      indices = torch.LongTensor([2, 4, 2, 3, 0, 1, 1, 0, 1])
      type_per_edge = torch.LongTensor([1, 1, 1, 1, 0, 0, 0, 0, 0])
      node_type_offset = torch.LongTensor([0, 2, 5])
      assert indptr[-1] == total_num_edges
      assert indptr[-1] == len(indices)
  
      # Construct FusedCSCSamplingGraph.
      graph = gb.fused_csc_sampling_graph(
          indptr,
          indices,
          node_type_offset=node_type_offset,
          type_per_edge=type_per_edge,
          node_type_to_id=ntypes,
          edge_type_to_id=etypes,
      )
  
      nodes = {"n1": torch.LongTensor([0]), "n2": torch.LongTensor([0])}
      subgraph = graph.sample_neighbors(
          nodes, torch.LongTensor([4]), replace=replace
      )
  
      # Verify in subgraph.
      assert (
          subgraph.sampled_csc["n1:e1:n2"].indices.numel()
          == expected_sampled_num1
      )
      assert subgraph.sampled_csc["n1:e1:n2"].indptr.size(0) == 2
      assert (
          subgraph.sampled_csc["n2:e2:n1"].indices.numel()
          == expected_sampled_num2
      )
      assert subgraph.sampled_csc["n2:e2:n1"].indptr.size(0) == 2
  
imports: import os
  import pickle
  import re
  import tempfile
  import unittest
  import backend
  import dgl
  import dgl.graphbolt
  import pytest
  import torch
  import torch.multiprocessing
  from dgl.graphbolt.base import etype_str_to_tuple
  from scipy import sparse
  from ..None import gb_test_utils
label_desc: Use image node_id 36 for calling a global function with example usage: test_sample_neighbors_replace(replace, expected_sampled_num1, expected_sampled_num2) without return types