code: def _maybe_copy_to_context_device(tensor, device_name):
      """Copy an EagerTensor to the current device if it's not on `device_name`."""
      in_device = tensor.backing_device
      if device_name == in_device:
          return tensor
      else:
          # Note that EagerTensor._copy bypasses the placer and copies to the context
          # device, which means e.g. int32 Tensors which would normally be forced onto
          # the CPU can instead be placed on the GPU. This is necessary so that the
          # PyFunc kernel always returns Tensors on the device it's executing on.
          return tensor._copy()
  
imports: import functools
  import threading
  import traceback
  import weakref
  import numpy
  from tensorflow.python.autograph.impl import api
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import backprop_util
  from tensorflow.python.eager import context
  from tensorflow.python.eager import record
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import function
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.framework import type_spec
  from tensorflow.python.lib.core import _pywrap_py_func
  from tensorflow.python.ops import autograph_ops
  from tensorflow.python.ops import gen_script_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.util import compat
  from tensorflow.python.util import deprecation
  from tensorflow.python.util import dispatch
  from tensorflow.python.util import nest
  from tensorflow.python.util import tf_inspect
  from tensorflow.python.util import variable_utils
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 1 for calling a global function with example usage: _maybe_copy_to_context_device(tensor, device_name) and returns: tensor, tensor