code: def test_num_nodes_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,
          "N1:R4:N0": 4,
      }
      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,
      )
  
      # Verify nodes number per node types.
      assert graph.num_nodes == {
          "N0": 2,
          "N1": 3,
      }
      assert sum(graph.num_nodes.values()) == total_num_nodes
      # Verify edges number per edge types.
      assert graph.num_edges == {
          "N0:R0:N0": 2,
          "N0:R1:N1": 4,
          "N1:R2:N0": 3,
          "N1:R3:N1": 3,
          "N1:R4:N0": 0,
      }
      assert sum(graph.num_edges.values()) == total_num_edges
  
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 8 for calling a global function with example usage: test_num_nodes_hetero() without return types