(self)
| 73 | coord.request_stop() |
| 74 | |
| 75 | def test_sparse(self): |
| 76 | with ops.Graph().as_default() as graph: |
| 77 | with ops.device('/cpu:0'): |
| 78 | values = array_ops.constant([1, 1, 1], dtype=dtypes.int64) |
| 79 | indices = array_ops.constant( |
| 80 | ([0, 0], [0, 1], [0, 2]), dtype=dtypes.int64) |
| 81 | dense_shape = array_ops.constant([3, 3], dtype=dtypes.int64) |
| 82 | |
| 83 | x = sparse_tensor.SparseTensor(values=values, |
| 84 | indices=indices, |
| 85 | dense_shape=dense_shape) |
| 86 | with ops.device(test.gpu_device_name()): |
| 87 | y = prefetch.staged(x, timeout_millis=1000) |
| 88 | |
| 89 | graph.finalize() |
| 90 | |
| 91 | with self.test_session(use_gpu=True, graph=graph) as sess: |
| 92 | values_data = sess.run(values) |
| 93 | indices_data = sess.run(indices) |
| 94 | dense_shape_data = sess.run(dense_shape) |
| 95 | coord = coordinator.Coordinator() |
| 96 | prefetch.make_prefetch_hook().after_create_session(sess, coord) |
| 97 | for _ in xrange(3): |
| 98 | prefetched = sess.run(y) |
| 99 | self.assertAllClose(values_data, prefetched.values, rtol=1e-6) |
| 100 | self.assertAllClose(indices_data, prefetched.indices, rtol=1e-6) |
| 101 | self.assertAllClose(dense_shape_data, prefetched.dense_shape, rtol=1e-6) |
| 102 | coord.request_stop() |
| 103 | |
| 104 | def test_list(self): |
| 105 | with ops.Graph().as_default() as graph: |
nothing calls this directly
no test coverage detected