(self)
| 58 | force_gpu_compatible=True)) |
| 59 | |
| 60 | def test_simple(self): |
| 61 | with self.test_session(): |
| 62 | works = [b"to", b"be", b"or", b"not", b"to", b"be"] |
| 63 | num_epochs = 3 |
| 64 | work_queue = WorkQueue(works, num_epochs=num_epochs, shuffle=False) |
| 65 | |
| 66 | local_queue = work_queue.input_producer() |
| 67 | dequeue = local_queue.dequeue() |
| 68 | dequeue_many = local_queue.dequeue_many(len(works) * num_epochs) |
| 69 | |
| 70 | resources.initialize_resources(resources.shared_resources()).run() |
| 71 | variables.global_variables_initializer().run() |
| 72 | variables.local_variables_initializer().run() |
| 73 | threads = queue_runner_impl.start_queue_runners() |
| 74 | |
| 75 | local_works = dequeue_many.eval().tolist() |
| 76 | self.assertEqual( |
| 77 | works * num_epochs, |
| 78 | [item for work in local_works for item in work]) |
| 79 | |
| 80 | # Reached the limit. |
| 81 | with self.assertRaises(errors_impl.OutOfRangeError): |
| 82 | dequeue.eval() |
| 83 | for thread in threads: |
| 84 | thread.join() |
| 85 | |
| 86 | def test_shuffle(self): |
| 87 | with self.test_session(): |
nothing calls this directly
no test coverage detected