1 def testPtbProducer(self):
2 raw_data = [4, 3, 2, 1, 0, 5, 6, 1, 1, 1, 1, 0, 3, 4, 1]
3 batch_size = 3
4 num_steps = 2
5 x, y = reader.ptb_producer(raw_data, batch_size, num_steps)
6 with self.test_session() as session:
7 coord = tf.train.Coordinator()
8 tf.train.start_queue_runners(session, coord=coord)
9 try:
10 xval, yval = session.run([x, y])
11 self.assertAllEqual(xval, [[4, 3], [5, 6], [1, 0]])
12 self.assertAllEqual(yval, [[3, 2], [6, 1], [0, 3]])
13 xval, yval = session.run([x, y])
14 self.assertAllEqual(xval, [[2, 1], [1, 1], [3, 4]])
18 self.assertAllEqual(yval, [[1, 0], [1, 1], [4, 1]])
19 finally:
20 coord.request_stop()
21 coord.join()