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

Method test_simple

tensorflow/python/ops/prefetch_test.py:39–55  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

37# pylint: disable=missing-docstring
38class 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

Callers

nothing calls this directly

Calls 11

request_stopMethod · 0.95
CoordinatorMethod · 0.80
as_defaultMethod · 0.45
GraphMethod · 0.45
deviceMethod · 0.45
constantMethod · 0.45
finalizeMethod · 0.45
test_sessionMethod · 0.45
after_create_sessionMethod · 0.45
assertAllCloseMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected