code: def test_subframes(parent_idx_device, child_device):
      parent_device, idx_device = parent_idx_device
      g = dgl.graph(
          (
              F.tensor([1, 2, 3], dtype=F.int64),
              F.tensor([2, 3, 4], dtype=F.int64),
          )
      )
      print(g.device)
      g.ndata["x"] = F.randn((5, 4))
      g.edata["a"] = F.randn((3, 6))
      idx = F.tensor([1, 2], dtype=F.int64)
      if parent_device == "cuda":
          g = g.to(F.cuda())
      elif parent_device == "uva":
          if F.backend_name != "pytorch":
              pytest.skip("UVA only supported for PyTorch")
          g = g.to(F.cpu())
          g.create_formats_()
          g.pin_memory_()
      elif parent_device == "cpu":
          g = g.to(F.cpu())
      idx = F.copy_to(idx, idx_device)
      sg = g.sample_neighbors(idx, 2).to(child_device)
      assert sg.device == F.context(sg.ndata["x"])
      assert sg.device == F.context(sg.edata["a"])
      assert sg.device == child_device
      if parent_device != "uva":
          sg = g.to(child_device).sample_neighbors(
              F.copy_to(idx, child_device), 2
          )
          assert sg.device == F.context(sg.ndata["x"])
          assert sg.device == F.context(sg.edata["a"])
          assert sg.device == child_device
      if parent_device == "uva":
          g.unpin_memory_()
  
imports: import unittest
  import backend
  import dgl
  import networkx
  import numpy
  import pytest
  import scipy.sparse
  from utils import parametrize_idtype
label_desc: Use image node_id 14 for calling a global function with example usage: test_subframes(parent_idx_device, child_device) without return types