code: def check_tensors_on_the_same_shared_memory(
      t1: torch.Tensor, t2: torch.Tensor
  ):
      """Check if two tensors are on the same shared memory.
  
      This function copies a random tensor value to `t1` and checks whether `t2`
      holds the same random value and checks whether t2 is a distinct tensor
      object from `t1`. Their equality confirms that they are separate tensors
      that rely on the shared memory for their tensor value.
      """
      assert t1.data_ptr() != t2.data_ptr()
      old_t1 = t1.clone()
      v = torch.randint_like(t1, 100)
      t1[:] = v
      assert torch.equal(t1, t2)
      t1[:] = old_t1
  
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 20 for calling a global function with example usage: check_tensors_on_the_same_shared_memory(t1, t2) without return types