code: def test_hetero_graph_on_shared_memory(
      total_num_nodes,
      total_num_edges,
      num_ntypes,
      num_etypes,
      test_node_attrs,
      test_edge_attrs,
  ):
      (
          csc_indptr,
          indices,
          node_type_offset,
          type_per_edge,
          node_type_to_id,
          edge_type_to_id,
      ) = gbt.random_hetero_graph(
          total_num_nodes, total_num_edges, num_ntypes, num_etypes
      )
  
      node_attributes = None
      if test_node_attrs:
          node_attributes = {
              "A1": torch.arange(total_num_nodes),
              "A2": torch.arange(total_num_nodes),
          }
  
      edge_attributes = None
      if test_edge_attrs:
          edge_attributes = {
              "A1": torch.randn(total_num_edges),
              "A2": torch.randn(total_num_edges),
          }
  
      graph = gb.fused_csc_sampling_graph(
          csc_indptr,
          indices,
          node_type_offset=node_type_offset,
          type_per_edge=type_per_edge,
          node_type_to_id=node_type_to_id,
          edge_type_to_id=edge_type_to_id,
          node_attributes=node_attributes,
          edge_attributes=edge_attributes,
      )
  
      shm_name = "test_hetero_g"
      graph1 = graph.copy_to_shared_memory(shm_name)
      graph2 = gb.load_from_shared_memory(shm_name)
  
      assert graph1.total_num_nodes == total_num_nodes
      assert graph1.total_num_nodes == total_num_nodes
      assert graph2.total_num_edges == total_num_edges
      assert graph2.total_num_edges == total_num_edges
  
      # Test the value of graph1 is correct
      assert torch.equal(graph1.csc_indptr, csc_indptr)
      assert torch.equal(graph1.indices, indices)
      assert torch.equal(graph1.node_type_offset, node_type_offset)
      assert torch.equal(graph1.type_per_edge, type_per_edge)
  
      # Test the value of graph2 is correct
      assert torch.equal(graph2.csc_indptr, csc_indptr)
      assert torch.equal(graph2.indices, indices)
      assert torch.equal(graph2.node_type_offset, node_type_offset)
      assert torch.equal(graph2.type_per_edge, type_per_edge)
  
      # Test the memory of graph1 and graph2 is on shared memory
      check_tensors_on_the_same_shared_memory(
          graph1.csc_indptr, graph2.csc_indptr
      )
      check_tensors_on_the_same_shared_memory(
          graph1.indices, graph2.indices
      )
      check_tensors_on_the_same_shared_memory(
          graph1.node_type_offset, graph2.node_type_offset
      )
      check_tensors_on_the_same_shared_memory(
          graph1.type_per_edge, graph2.type_per_edge
      )
  
      if test_node_attrs:
          check_node_edge_attributes(
              graph1, graph2, node_attributes, "node_attributes"
          )
      if test_edge_attrs:
          check_node_edge_attributes(
              graph1, graph2, edge_attributes, "edge_attributes"
          )
  
      assert node_type_to_id == graph1.node_type_to_id
      assert edge_type_to_id == graph1.edge_type_to_id
      assert node_type_to_id == graph2.node_type_to_id
      assert edge_type_to_id == graph2.edge_type_to_id
  
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 23 for calling a global function with example usage: test_hetero_graph_on_shared_memory(total_num_nodes, total_num_edges, num_ntypes, num_etypes, test_node_attrs, test_edge_attrs) without return types