code: def test_in_subgraph_hetero():
      """Original graph in COO:
      1   0   1   0   1
      1   0   1   1   0
      0   1   0   1   0
      0   1   0   0   1
      1   0   0   0   1
  
      node_type_0: [0, 1]
      node_type_1: [2, 3, 4]
      edge_type_0: node_type_0 -> node_type_0
      edge_type_1: node_type_0 -> node_type_1
      edge_type_2: node_type_1 -> node_type_0
      edge_type_3: node_type_1 -> node_type_1
      """
      # Initialize data.
      total_num_nodes = 5
      total_num_edges = 12
      ntypes = {
          "N0": 0,
          "N1": 1,
      }
      etypes = {
          "N0:R0:N0": 0,
          "N0:R1:N1": 1,
          "N1:R2:N0": 2,
          "N1:R3:N1": 3,
      }
      indptr = torch.LongTensor([0, 3, 5, 7, 9, 12])
      indices = torch.LongTensor([0, 1, 4, 2, 3, 0, 1, 1, 2, 0, 3, 4])
      node_type_offset = torch.LongTensor([0, 2, 5])
      type_per_edge = torch.LongTensor(
          [0, 0, 2, 2, 2, 1, 1, 1, 3, 1, 3, 3]
      )
      assert indptr[-1] == total_num_edges
      assert indptr[-1] == len(indices)
      assert node_type_offset[-1] == total_num_nodes
      assert all(type_per_edge < len(etypes))
  
      # 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,
      ).to(F.ctx())
  
      # Extract in subgraph.
      nodes = {
          "N0": torch.tensor([1], device=F.ctx()),
          "N1": torch.tensor([2, 1], device=F.ctx()),
      }
      in_subgraph = graph.in_subgraph(nodes)
  
      # Verify in subgraph.
      assert torch.equal(
          in_subgraph.sampled_csc["N0:R0:N0"].indices,
          torch.tensor([], device=F.ctx()),
      )
      assert torch.equal(
          in_subgraph.sampled_csc["N0:R0:N0"].indptr,
          torch.tensor([0, 0], device=F.ctx()),
      )
      assert torch.equal(
          in_subgraph.sampled_csc["N0:R1:N1"].indices,
          torch.tensor([0, 1], device=F.ctx()),
      )
      assert torch.equal(
          in_subgraph.sampled_csc["N0:R1:N1"].indptr,
          torch.tensor([0, 1, 2], device=F.ctx()),
      )
      assert torch.equal(
          in_subgraph.sampled_csc["N1:R2:N0"].indices,
          torch.tensor([0, 1], device=F.ctx()),
      )
      assert torch.equal(
          in_subgraph.sampled_csc["N1:R2:N0"].indptr,
          torch.tensor([0, 2], device=F.ctx()),
      )
      assert torch.equal(
          in_subgraph.sampled_csc["N1:R3:N1"].indices,
          torch.tensor([1, 2, 0], device=F.ctx()),
      )
      assert torch.equal(
          in_subgraph.sampled_csc["N1:R3:N1"].indptr,
          torch.tensor([0, 2, 3], device=F.ctx()),
      )
      assert in_subgraph.original_column_node_ids is None
      assert in_subgraph.original_row_node_ids is None
      assert torch.equal(
          in_subgraph.original_edge_ids,
          torch.tensor([3, 4, 9, 10, 11, 7, 8], device=F.ctx()),
      )
  
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 17 for calling a global function with example usage: test_in_subgraph_hetero() without return types