class_docstr: Wraps an iterator to provide async prefetching.
  
  DEPRECATION WARNING:
  TensorFlow datasets no longer require manual prefetching.
  
  Previously this class was used to make data loading using TensorFlow datasets
  more efficient. Now TF data handles prefetching with NumPy iterators
  correctly.
  
  Example::
  
    tf_iter = dataset.as_numpy_iterator()  # only loads data while calling next
    tf_iter = PrefetchIterator(tf_iter)  # prefetches data in the background
docstr: Construct a PrefetchIterator.
  
  Args:
    data_iter: the Iterator that should be prefetched.
    buffer_size: how many items to prefetch (default: 1).
docstr_tok: ["Construct","a","PrefetchIterator",".","Args",":","data_iter",":","the","Iterator","that","should","be","prefetched",".","buffer_size",":","how","many","items","to","prefetch","(","default",":","1",")","."]
code: def __init__(self, data_iter, buffer_size=1):
      """Construct a PrefetchIterator.
  
      Args:
        data_iter: the Iterator that should be prefetched.
        buffer_size: how many items to prefetch (default: 1).
      """
      warnings.warn(
          "PrefetchIterator is deprecated. Use the standard `tf.data`"
          " prefetch method instead",
          DeprecationWarning,
      )
  
      self._data_iter = data_iter
      self.buffer_size = buffer_size
      self._cond = threading.Condition()
      self._buffer = []
      self._active = True
      self._thread = threading.Thread(
          target=self._prefetch_loop, daemon=True
      )
      self._thread.start()
      self._error = None
  
imports: import threading
  import warnings
label_desc: Use image node_id 1 to create a new PrefetchIterator object  with example: obj = PrefetchIterator(data_iter, buffer_size)