Clear the queue, then call dataflow.__iter__() again and fill into the queue.
(self)
| 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 | """ |
nothing calls this directly
no test coverage detected