code: def test_sampled_subgraph_to_device():
      # Initialize data.
      csc_format = {
          "A:relation:B": gb.CSCFormatBase(
              indptr=torch.tensor([0, 1, 2, 3]),
              indices=torch.tensor([0, 1, 2]),
          )
      }
      original_row_node_ids = {
          "A": torch.tensor([13, 14, 15]),
      }
      src_to_exclude = torch.tensor([15, 13])
      original_column_node_ids = {
          "B": torch.tensor([10, 11, 12]),
      }
      dst_to_exclude = torch.tensor([10, 12])
      original_edge_ids = {"A:relation:B": torch.tensor([19, 20, 21])}
      subgraph = SampledSubgraphImpl(
          sampled_csc=csc_format,
          original_column_node_ids=original_column_node_ids,
          original_row_node_ids=original_row_node_ids,
          original_edge_ids=original_edge_ids,
      )
      edges_to_exclude = {
          "A:relation:B": (
              src_to_exclude,
              dst_to_exclude,
          )
      }
      graph = subgraph.exclude_edges(edges_to_exclude)
  
      # Copy to device.
      graph = graph.to("cuda")
  
      # Check.
      for key in graph.sampled_csc:
          assert graph.sampled_csc[key].indices.device.type == "cuda"
          assert graph.sampled_csc[key].indptr.device.type == "cuda"
      for key in graph.original_column_node_ids:
          assert (
              graph.original_column_node_ids[key].device.type == "cuda"
          )
      for key in graph.original_row_node_ids:
          assert graph.original_row_node_ids[key].device.type == "cuda"
      for key in graph.original_edge_ids:
          assert graph.original_edge_ids[key].device.type == "cuda"
  
file_path: dgl/tests/python/pytorch/graphbolt/impl/test_sampled_subgraph_impl.py
imports: import unittest
  import backend
  import dgl.graphbolt
  import pytest
  import torch
  from dgl.graphbolt.impl.sampled_subgraph_impl import SampledSubgraphImpl
label_desc: Use image node_id 6 for calling a global function with example usage: test_sampled_subgraph_to_device() without return types