code: def move_to_device(x, device_id):
      if hasattr(x, "device") and x.device.id == device_id:
          return x
  
      assert device_id >= 0
  
      if issparse(x) and device_id > 0:
          raise NotImplementedError
  
      # for dense array, we currently copy from gpu to memory and then copy back to destination device
      # to avoid kernel panic
      with cp.cuda.Device(device_id):
          return cp.asarray(cp.asnumpy(x))
  
file_path: mars/mars/tensor/array_utils.py
imports: from collections import defaultdict
  from contextlib import contextmanager
  import numpy
  from ..lib import sparse
  from ..lib.sparse.core import issparse, get_dense_module
  from ..utils import lazy_import
label_desc: Use image node_id 6 for calling a global function with example usage: move_to_device(x, device_id) and returns: x, cp