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

Method test_list

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

Source from the content-addressed store, hash-verified

102 coord.request_stop()
103
104 def test_list(self):
105 with ops.Graph().as_default() as graph:
106 with ops.device('/cpu:0'):
107 values = array_ops.constant([1, 1, 1], dtype=dtypes.int64)
108 indices = array_ops.constant(
109 ([0, 0], [0, 1], [0, 2]), dtype=dtypes.int64)
110 dense_shape = array_ops.constant([3, 3], dtype=dtypes.int64)
111
112 x1 = sparse_tensor.SparseTensor(values=values,
113 indices=indices,
114 dense_shape=dense_shape)
115 x2 = array_ops.constant(42.0, dtype=dtypes.float32, shape=[])
116 x = [x1, x2]
117 with ops.device(test.gpu_device_name()):
118 y = prefetch.staged(x, timeout_millis=1000)
119
120 graph.finalize()
121
122 with self.test_session(use_gpu=True, graph=graph) as sess:
123 values_data = sess.run(values)
124 indices_data = sess.run(indices)
125 dense_shape_data = sess.run(dense_shape)
126 x2_data = sess.run(x2)
127 coord = coordinator.Coordinator()
128 prefetch.make_prefetch_hook().after_create_session(sess, coord)
129 for _ in xrange(3):
130 prefetched = sess.run(y)
131 self.assertAllClose(values_data, prefetched[0].values, rtol=1e-6)
132 self.assertAllClose(indices_data, prefetched[0].indices, rtol=1e-6)
133 self.assertAllClose(
134 dense_shape_data, prefetched[0].dense_shape,
135 rtol=1e-6)
136 self.assertAllClose(x2_data, prefetched[1], rtol=1e-6)
137 coord.request_stop()
138
139 def test_dict(self):
140 with ops.Graph().as_default() as graph:

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
runMethod · 0.45
after_create_sessionMethod · 0.45
assertAllCloseMethod · 0.45

Tested by

no test coverage detected