(self)
| 37 | # pylint: disable=missing-docstring |
| 38 | class PrefetchTest(test.TestCase): |
| 39 | def test_simple(self): |
| 40 | capacity = 2 |
| 41 | value = 42.0 |
| 42 | with ops.Graph().as_default() as graph: |
| 43 | with ops.device('/cpu:0'): |
| 44 | x = array_ops.constant(value, dtype=dtypes.float32, shape=[]) |
| 45 | with ops.device(test.gpu_device_name()): |
| 46 | y = prefetch.staged(x, capacity=capacity, num_threads=2, timeout_millis=1000) |
| 47 | |
| 48 | graph.finalize() |
| 49 | |
| 50 | with self.test_session(use_gpu=True, graph=graph) as sess: |
| 51 | coord = coordinator.Coordinator() |
| 52 | prefetch.make_prefetch_hook().after_create_session(sess, coord) |
| 53 | for _ in xrange(capacity * 3): |
| 54 | self.assertAllClose(value, sess.run(y), rtol=1e-6) |
| 55 | coord.request_stop() |
| 56 | |
| 57 | def test_string(self): |
| 58 | capacity = 3 |
nothing calls this directly
no test coverage detected