code: def test_neighbor_sampler_basic():
      edge_index = erdos_renyi_graph(num_nodes=10, edge_prob=0.5)
      adj_t = SparseTensor.from_edge_index(
          edge_index, sparse_sizes=(10, 10)
      ).t()
      E = edge_index.size(1)
  
      loader = NeighborSampler(edge_index, sizes=[2, 4], batch_size=2)
      assert str(loader) == "NeighborSampler(sizes=[2, 4])"
      assert len(loader) == 5
  
      for batch_size, n_id, adjs in loader:
          assert batch_size == 2
          assert all(np.isin(n_id, torch.arange(10)).tolist())
          assert n_id.unique().size(0) == n_id.size(0)
          for edge_index, e_id, size in adjs:
              assert int(edge_index[0].max() + 1) <= size[0]
              assert int(edge_index[1].max() + 1) <= size[1]
              assert all(np.isin(e_id, torch.arange(E)).tolist())
              assert e_id.unique().size(0) == e_id.size(0)
              assert size[0] >= size[1]
  
      out = loader.sample([1, 2])
      assert len(out) == 3
  
      loader = NeighborSampler(adj_t, sizes=[2, 4], batch_size=2)
  
      for batch_size, n_id, adjs in loader:
          for adj_t, e_id, size in adjs:
              assert adj_t.size(0) == size[1]
              assert adj_t.size(1) == size[0]
  
file_path: pytorch_geometric/test/loader/test_neighbor_sampler.py
imports: import numpy
  import torch
  from torch_geometric.loader import NeighborSampler
  from torch_geometric.nn.conv import GATConv, SAGEConv
  from torch_geometric.testing import onlyOnline, withPackage
  from torch_geometric.typing import SparseTensor
  from torch_geometric.utils import erdos_renyi_graph
label_desc: Use image node_id 1 for calling a global function with example usage: test_neighbor_sampler_basic() without return types