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 testIteratorOnDeviceGraphModeInitializableIterator(self):
      dataset = dataset_ops.Dataset.range(10)
      dataset = dataset.apply(
          prefetching_ops.prefetch_to_device("/gpu:0")
      )
      iterator = dataset_ops.make_initializable_iterator(dataset)
      data = iterator.get_next()
      optional_data = iterator.get_next_as_optional()
  
      with ops.colocate_with(dataset._variant_tensor):
          dataset_device = test_ops.device_placement_op()
      self.assertIn(b"GPU:0", self.evaluate(dataset_device))
  
      with ops.colocate_with(iterator._iterator_resource):
          iterator_device = test_ops.device_placement_op()
      self.assertIn(b"GPU:0", self.evaluate(iterator_device))
  
      with ops.colocate_with(data):
          data_device = test_ops.device_placement_op()
      self.assertIn(b"GPU:0", self.evaluate(data_device))
  
      with ops.colocate_with(optional_data.get_value()):
          get_value_device = test_ops.device_placement_op()
      self.assertIn(b"GPU:0", self.evaluate(get_value_device))
  
      with ops.colocate_with(optional_data.has_value()):
          has_value_device = test_ops.device_placement_op()
      self.assertIn(b"GPU:0", self.evaluate(has_value_device))
  
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 12 for calling the PlacementTest obj's underlying member method code with example usage: obj.testIteratorOnDeviceGraphModeInitializableIterator() without return types