MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / refill_queue

Method refill_queue

tensorpack/input_source/input_source.py:226–244  ·  view source on GitHub ↗

Clear the queue, then call dataflow.__iter__() again and fill into the queue.

(self)

Source from the content-addressed store, hash-verified

224 self._dequeue_op = self.queue.dequeue(name='dequeue_for_reset')
225
226 def refill_queue(self):
227 """
228 Clear the queue, then call dataflow.__iter__() again and fill into the queue.
229 """
230 self.thread.pause() # pause enqueue
231
232 opt = tfv1.RunOptions()
233 opt.timeout_in_ms = 2000 # 2s
234 sess = tfv1.get_default_session()
235 # dequeue until empty
236 try:
237 while True:
238 sess.run(self._dequeue_op, options=opt)
239 except tf.errors.DeadlineExceededError:
240 pass
241
242 # reset dataflow, start thread
243 self.thread.reinitialize_dataflow()
244 self.thread.resume()
245
246 def _create_ema_callback(self):
247 """

Callers

nothing calls this directly

Calls 4

reinitialize_dataflowMethod · 0.80
pauseMethod · 0.45
runMethod · 0.45
resumeMethod · 0.45

Tested by

no test coverage detected