class_docstr: Holds a list of enqueue operations for a queue, each to be run in a thread.
  
  Queues are a convenient TensorFlow mechanism to compute tensors
  asynchronously using multiple threads. For example in the canonical 'Input
  Reader' setup one set of threads generates filenames in a queue; a second set
  of threads read records from the files, processes them, and enqueues tensors
  on a second queue; a third set of threads dequeues these input records to
  construct batches and runs them through training operations.
  
  There are several delicate issues when running multiple threads that way:
  closing the queues in sequence as the input is exhausted, correctly catching
  and reporting exceptions, etc.
  
  The `QueueRunner`, combined with the `Coordinator`, helps handle these issues.
  
  @compatibility(TF2)
  QueueRunners are not compatible with eager execution. Instead, please
  use [tf.data](https://www.tensorflow.org/guide/data) to get data into your
  model.
  @end_compatibility
class_docstr_tok: ["Holds","a","list","of","enqueue","operations","for","a","queue",",","each","to","be","run","in","a","thread",".","Queues","are","a","convenient","TensorFlow","mechanism","to","compute","tensors","asynchronously","using","multiple","threads",".","For","example","in","the","canonical","'Input","Reader","'","setup","one","set","of","threads","generates","filenames","in","a","queue",";","a","second","set","of","threads","read","records","from","the","files",",","processes","them",",","and","enqueues","tensors","on","a","second","queue",";","a","third","set","of","threads","dequeues","these","input","records","to","construct","batches","and","runs","them","through","training","operations",".","There","are","several","delicate","issues","when","running","multiple","threads","that","way",":","closing","the","queues","in","sequence","as","the","input","is","exhausted",",","correctly","catching","and","reporting","exceptions",",","etc",".","The","`","QueueRunner","`",",","combined","with","the","`","Coordinator","`",",","helps","handle","these","issues",".","@","compatibility","(","TF2",")","QueueRunners","are","not","compatible","with","eager","execution",".","Instead",",","please","use","[","tf.data","]","(","https",":","\/\/www.tensorflow.org\/guide\/data",")","to","get","data","into","your","model",".","@","end_compatibility"]
docstr: Create a QueueRunner from arguments.
  
  Args:
    queue: A `Queue`.
    enqueue_ops: List of enqueue ops to run in threads later.
    close_op: Op to close the queue. Pending enqueue ops are preserved.
    cancel_op: Op to close the queue and cancel pending enqueue ops.
    queue_closed_exception_types: Tuple of exception types, which indicate
      the queue has been safely closed.
  
  Raises:
    ValueError: If `queue` or `enqueue_ops` are not provided when not
      restoring from `queue_runner_def`.
    TypeError: If `queue_closed_exception_types` is provided, but is not
      a non-empty tuple of error types (subclasses of `tf.errors.OpError`).
docstr_tok: ["Create","a","QueueRunner","from","arguments",".","Args",":","queue",":","A","`","Queue","`",".","enqueue_ops",":","List","of","enqueue","ops","to","run","in","threads","later",".","close_op",":","Op","to","close","the","queue",".","Pending","enqueue","ops","are","preserved",".","cancel_op",":","Op","to","close","the","queue","and","cancel","pending","enqueue","ops",".","queue_closed_exception_types",":","Tuple","of","exception","types",",","which","indicate","the","queue","has","been","safely","closed",".","Raises",":","ValueError",":","If","`","queue","`","or","`","enqueue_ops","`","are","not","provided","when","not","restoring","from","`","queue_runner_def","`",".","TypeError",":","If","`","queue_closed_exception_types","`","is","provided",",","but","is","not","a","non-empty","tuple","of","error","types","(","subclasses","of","`","tf.errors.OpError","`",")","."]
code: def _init_from_args(
      self,
      queue=None,
      enqueue_ops=None,
      close_op=None,
      cancel_op=None,
      queue_closed_exception_types=None,
  ):
      """Create a QueueRunner from arguments.
  
      Args:
        queue: A `Queue`.
        enqueue_ops: List of enqueue ops to run in threads later.
        close_op: Op to close the queue. Pending enqueue ops are preserved.
        cancel_op: Op to close the queue and cancel pending enqueue ops.
        queue_closed_exception_types: Tuple of exception types, which indicate
          the queue has been safely closed.
  
      Raises:
        ValueError: If `queue` or `enqueue_ops` are not provided when not
          restoring from `queue_runner_def`.
        TypeError: If `queue_closed_exception_types` is provided, but is not
          a non-empty tuple of error types (subclasses of `tf.errors.OpError`).
      """
      if not queue or not enqueue_ops:
          raise ValueError("Must provide queue and enqueue_ops.")
      self._queue = queue
      self._enqueue_ops = enqueue_ops
      self._close_op = close_op
      self._cancel_op = cancel_op
      if queue_closed_exception_types is not None:
          if (
              not isinstance(queue_closed_exception_types, tuple)
              or not queue_closed_exception_types
              or not all(
                  issubclass(t, errors.OpError)
                  for t in queue_closed_exception_types
              )
          ):
              raise TypeError(
                  "queue_closed_exception_types, when provided, "
                  "must be a tuple of tf.error types, but saw: %s"
                  % queue_closed_exception_types
              )
      self._queue_closed_exception_types = queue_closed_exception_types
      # Close when no more will be produced, but pending enqueues should be
      # preserved.
      if self._close_op is None:
          self._close_op = self._queue.close()
      # Close and cancel pending enqueues since there was an error and we want
      # to unblock everything so we can cleanly exit.
      if self._cancel_op is None:
          self._cancel_op = self._queue.close(
              cancel_pending_enqueues=True
          )
      if not self._queue_closed_exception_types:
          self._queue_closed_exception_types = (errors.OutOfRangeError,)
      else:
          self._queue_closed_exception_types = tuple(
              self._queue_closed_exception_types
          )
  
imports: import threading
  import weakref
  from tensorflow.core.protobuf import queue_runner_pb2
  from tensorflow.python.client import session
  from tensorflow.python.eager import context
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import deprecation
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling the QueueRunner obj's underlying member method code with example usage: obj._init_from_args(queue, enqueue_ops, close_op, cancel_op, queue_closed_exception_types) without return types