code: def copy_to_device(target_device, source_device="/cpu:0"):
      """A transformation that copies dataset elements to the given `target_device`.
  
      Args:
        target_device: The name of a device to which elements will be copied.
        source_device: The original device on which `input_dataset` will be placed.
  
      Returns:
        A `Dataset` transformation function, which can be passed to
        `tf.data.Dataset.apply`.
      """
  
      def _apply_fn(dataset):
          return _CopyToDeviceDataset(
              dataset,
              target_device=target_device,
              source_device=source_device,
          )
  
      return _apply_fn
  
imports: from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import iterator_ops
  from tensorflow.python.data.ops import structured_function
  from tensorflow.python.data.util import structure
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import device
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import functional_ops
  from tensorflow.python.ops import gen_dataset_ops
  from tensorflow.python.ops import gen_experimental_dataset_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling a global function with example usage: copy_to_device(target_device, source_device) and returns: _apply_fn, _CopyToDeviceDataset