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 threads to run the enqueue ops for the given session.
  
  This method requires a session in which the graph was launched.  It creates
  a list of threads, optionally starting them.  There is one thread for each
  op passed in `enqueue_ops`.
  
  The `coord` argument is an optional coordinator that the threads will use
  to terminate together and report exceptions.  If a coordinator is given,
  this method starts an additional thread to close the queue when the
  coordinator requests a stop.
  
  If previously created threads for the given session are still running, no
  new threads will be created.
  
  Args:
    sess: A `Session`.
    coord: Optional `Coordinator` object for reporting errors and checking
      stop conditions.
    daemon: Boolean.  If `True` make the threads daemon threads.
    start: Boolean.  If `True` starts the threads.  If `False` the
      caller must call the `start()` method of the returned threads.
  
  Returns:
    A list of threads.
docstr_tok: ["Create","threads","to","run","the","enqueue","ops","for","the","given","session",".","This","method","requires","a","session","in","which","the","graph","was","launched",".","It","creates","a","list","of","threads",",","optionally","starting","them",".","There","is","one","thread","for","each","op","passed","in","`","enqueue_ops","`",".","The","`","coord","`","argument","is","an","optional","coordinator","that","the","threads","will","use","to","terminate","together","and","report","exceptions",".","If","a","coordinator","is","given",",","this","method","starts","an","additional","thread","to","close","the","queue","when","the","coordinator","requests","a","stop",".","If","previously","created","threads","for","the","given","session","are","still","running",",","no","new","threads","will","be","created",".","Args",":","sess",":","A","`","Session","`",".","coord",":","Optional","`","Coordinator","`","object","for","reporting","errors","and","checking","stop","conditions",".","daemon",":","Boolean",".","If","`","True","`","make","the","threads","daemon","threads",".","start",":","Boolean",".","If","`","True","`","starts","the","threads",".","If","`","False","`","the","caller","must","call","the","`","start","(",")","`","method","of","the","returned","threads",".","Returns",":","A","list","of","threads","."]
code: def create_threads(self, sess, coord=None, daemon=False, start=False):
      """Create threads to run the enqueue ops for the given session.
  
      This method requires a session in which the graph was launched.  It creates
      a list of threads, optionally starting them.  There is one thread for each
      op passed in `enqueue_ops`.
  
      The `coord` argument is an optional coordinator that the threads will use
      to terminate together and report exceptions.  If a coordinator is given,
      this method starts an additional thread to close the queue when the
      coordinator requests a stop.
  
      If previously created threads for the given session are still running, no
      new threads will be created.
  
      Args:
        sess: A `Session`.
        coord: Optional `Coordinator` object for reporting errors and checking
          stop conditions.
        daemon: Boolean.  If `True` make the threads daemon threads.
        start: Boolean.  If `True` starts the threads.  If `False` the
          caller must call the `start()` method of the returned threads.
  
      Returns:
        A list of threads.
      """
      with self._lock:
          try:
              if self._runs_per_session[sess] > 0:
                  # Already started: no new threads to return.
                  return []
          except KeyError:
              # We haven't seen this session yet.
              pass
          self._runs_per_session[sess] = len(self._enqueue_ops)
          self._exceptions_raised = []
  
      ret_threads = []
      for op in self._enqueue_ops:
          name = "QueueRunnerThread-{}-{}".format(self.name, op.name)
          ret_threads.append(
              threading.Thread(
                  target=self._run, args=(sess, op, coord), name=name
              )
          )
      if coord:
          name = "QueueRunnerThread-{}-close_on_stop".format(self.name)
          ret_threads.append(
              threading.Thread(
                  target=self._close_on_stop,
                  args=(sess, self._cancel_op, coord),
                  name=name,
              )
          )
      for t in ret_threads:
          if coord:
              coord.register_thread(t)
          if daemon:
              t.daemon = True
          if start:
              t.start()
      return ret_threads
  
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 13 for calling the QueueRunner obj's underlying member method code with example usage: obj.create_threads(sess, coord, daemon, start) and returns: ret_threads, list