class_docstr: Tests for tf.data placement within tf.functions.
  
  Specifically, tf.data dataset tensors cannot be copied between devices. These
  tests verify the ops are placed in a way that avoids this.
class_docstr_tok: ["Tests","for","tf.data","placement","within","tf.functions",".","Specifically",",","tf.data","dataset","tensors","can","not","be","copied","between","devices",".","These","tests","verify","the","ops","are","placed","in","a","way","that","avoids","this","."]
code: def testIteratorOnDeviceEagerMode(self):
      dataset = dataset_ops.Dataset.range(10)
      dataset = dataset.apply(
          prefetching_ops.prefetch_to_device("/gpu:0")
      )
      iterator = iter(dataset)
      data = next(iterator)
      optional_data = iterator.get_next_as_optional()
  
      self.assertIn("gpu:0", dataset._variant_tensor.device.lower())
      self.assertIn("gpu:0", iterator._iterator_resource.device.lower())
      self.assertIn("gpu:0", data.device.lower())
      self.assertIn("gpu:0", optional_data.get_value().device.lower())
      self.assertIn("gpu:0", optional_data.has_value().device.lower())
  
imports: from absl.testing import parameterized
  from tensorflow.python.data.experimental.ops import prefetching_ops
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import gen_dataset_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 9 for calling the PlacementTest obj's underlying member method code with example usage: obj.testIteratorOnDeviceEagerMode() without return types