class_docstr: Represents worker-distributed datasets created from dataset function.
class_docstr_tok: ["Represents","worker-distributed","datasets","created","from","dataset","function","."]
code: def __iter__(self):
      # We would like users to create iterators outside `tf.function`s so that we
      # can track them.
      if (
          not context.executing_eagerly()
          or ops.get_default_graph().building_function
      ):
          raise RuntimeError(
              "__iter__() is not supported inside of tf.function or in graph mode."
          )
  
      def _create_per_worker_iterator():
          dataset = self._dataset_fn()
          return iter(dataset)
  
      # If PerWorkerDatasetFromDatasetFunction.__iter__ is called multiple
      # times, for the same object it should only create and register resource
      # once. Using object id to distinguish different iterator resources.
      per_worker_iterator = (
          self._coordinator._create_per_worker_resources(
              _create_per_worker_iterator
          )
      )
  
      # Setting type_spec of each RemoteValue so that functions taking these
      # RemoteValues as inputs can be traced.
      for iterator_remote_value in per_worker_iterator._values:
          iterator_remote_value._type_spec = (
              input_lib.get_iterator_spec_from_dataset(
                  self._coordinator.strategy,
                  self._dataset_fn.structured_outputs,
              )
          )
  
      return PerWorkerDistributedIterator(per_worker_iterator._values)
  
imports: import threading
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops.options import ExternalStatePolicy
  from tensorflow.python.distribute import input_lib
  from tensorflow.python.distribute.coordinator import remote_value
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import function
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import type_spec
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_dataset_ops
  from tensorflow.python.ops import gen_experimental_dataset_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.util import nest
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 3 for calling the PerWorkerDatasetFromDatasetFunction obj's underlying member method code with example usage: obj.__iter__() and returns: PerWorkerDistributedIterator, iter