MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / test_shuffle

Method test_shuffle

tensorflow/python/ops/work_queue_test.py:86–110  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

84 thread.join()
85
86 def test_shuffle(self):
87 with self.test_session():
88 works = [b"to", b"be", b"or", b"not", b"to", b"be"]
89 num_epochs = 1
90 work_queue = WorkQueue(works, num_epochs=num_epochs, shuffle=True)
91
92 local_queue = work_queue.input_producer()
93 dequeue = local_queue.dequeue()
94 dequeue_many = local_queue.dequeue_many(len(works) * num_epochs)
95
96 resources.initialize_resources(resources.shared_resources()).run()
97 variables.global_variables_initializer().run()
98 variables.local_variables_initializer().run()
99 threads = queue_runner_impl.start_queue_runners()
100
101 local_works = dequeue_many.eval().tolist()
102 self.assertEqual(
103 sorted(works * num_epochs),
104 sorted([item for work in local_works for item in work]))
105
106 # Reached the limit.
107 with self.assertRaises(errors_impl.OutOfRangeError):
108 dequeue.eval()
109 for thread in threads:
110 thread.join()
111
112 def test_slices(self):
113 with self.test_session():

Callers

nothing calls this directly

Calls 9

input_producerMethod · 0.95
WorkQueueClass · 0.90
dequeue_manyMethod · 0.80
test_sessionMethod · 0.45
dequeueMethod · 0.45
runMethod · 0.45
start_queue_runnersMethod · 0.45
evalMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected