def __init__(self, queue, enqueue_ops):
"""Create a PyQueueRunner.
When you later call the `create_threads()` method, the `QueueRunner` will
create one thread for each op in `enqueue_ops`. Each thread will run its
enqueue op in parallel with the other threads. The enqueue ops do not have
to all be the same op, but it is expected that they all enqueue tensors in
`queue`.
Args:
qnqueue_handler: a python function that transforms
queue: A `Queue`.
enqueue_ops: List of enqueue ops to run in threads later.
"""
self._queue = queue
self._enqueue_ops = enqueue_ops
self._lock = threading.Lock()
# A map from a session object to the number of outstanding queue runner
# threads for that session.
self._runs_per_session = weakref.WeakKeyDictionary()
评论列表
文章目录