Python reader 模块,ptb_producer() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用reader.ptb_producer()

项目:taas-examples    作者:caicloud    | 项目源码 | 文件源码
def testPtbProducer(self):
    raw_data = [4, 3, 2, 1, 0, 5, 6, 1, 1, 1, 1, 0, 3, 4, 1]
    batch_size = 3
    num_steps = 2
    x, y = reader.ptb_producer(raw_data, batch_size, num_steps)
    with self.test_session() as session:
      coord = tf.train.Coordinator()
      tf.train.start_queue_runners(session, coord=coord)
      try:
        xval, yval = session.run([x, y])
        self.assertAllEqual(xval, [[4, 3], [5, 6], [1, 0]])
        self.assertAllEqual(yval, [[3, 2], [6, 1], [0, 3]])
        xval, yval = session.run([x, y])
        self.assertAllEqual(xval, [[2, 1], [1, 1], [3, 4]])
        self.assertAllEqual(yval, [[1, 0], [1, 1], [4, 1]])
      finally:
        coord.request_stop()
        coord.join()
项目:ActionRecognition    作者:woodfrog    | 项目源码 | 文件源码
def testPtbProducer(self):
        raw_data = [4, 3, 2, 1, 0, 5, 6, 1, 1, 1, 1, 0, 3, 4, 1]
        batch_size = 3
        num_steps = 2
        x, y = reader.ptb_producer(raw_data, batch_size, num_steps)
        with self.test_session() as session:
            coord = tf.train.Coordinator()
            tf.train.start_queue_runners(session, coord=coord)
            try:
                xval, yval = session.run([x, y])
                self.assertAllEqual(xval, [[4, 3], [5, 6], [1, 0]])
                self.assertAllEqual(yval, [[3, 2], [6, 1], [0, 3]])
                xval, yval = session.run([x, y])
                self.assertAllEqual(xval, [[2, 1], [1, 1], [3, 4]])
                self.assertAllEqual(yval, [[1, 0], [1, 1], [4, 1]])
            finally:
                coord.request_stop()
                coord.join()
项目:Fast-Slow-LSTM    作者:amujika    | 项目源码 | 文件源码
def __init__(self, config, data, name=None):
        self.batch_size = batch_size = config.batch_size
        self.num_steps = num_steps = config.num_steps
        self.epoch_size = ((len(data) // batch_size) - 1) // num_steps
        self.input_data, self.targets = reader.ptb_producer(
            data, batch_size, num_steps, name=name)
项目:YellowFin    作者:JianGoForIt    | 项目源码 | 文件源码
def __init__(self, config, data, name=None):
    self.batch_size = batch_size = config.batch_size
    self.num_steps = num_steps = config.num_steps
    self.epoch_size = ((len(data) // batch_size) - 1) // num_steps
    self.input_data, self.targets = reader.ptb_producer(
        data, batch_size, num_steps, name=name)
项目:DeepLearningAndTensorflow    作者:azheng333    | 项目源码 | 文件源码
def __init__(self, config, data, name=None):
        self.batch_size = batch_size = config.batch_size
        self.num_steps = num_steps = config.num_steps
        self.epoch_size = ((len(data) // batch_size) - 1) // num_steps
        self.input_data, self.targets = reader.ptb_producer(
            data, batch_size, num_steps, name=name)
项目:gradual-learning-rnn    作者:zivaharoni    | 项目源码 | 文件源码
def __init__(self, config, data, name=None):
        self.batch_size = batch_size = config.batch_size
        self.time_steps = time_steps = config.time_steps
        self.epoch_size = ((len(data) // batch_size) - 1) // time_steps
        self.input_data, self.targets = reader.ptb_producer(
            data, batch_size, time_steps, name=name)
项目:taas-examples    作者:caicloud    | 项目源码 | 文件源码
def __init__(self, config, data, name=None):
    self.batch_size = batch_size = config.batch_size
    self.num_steps = num_steps = config.num_steps
    self.epoch_size = ((len(data) // batch_size) - 1) // num_steps
    self.input_data, self.targets = reader.ptb_producer(
        data, batch_size, num_steps, name=name)
项目:tensorflow-statereader    作者:sebastianGehrmann    | 项目源码 | 文件源码
def __init__(self, data, name=None):
        self.batch_size = batch_size = FLAGS.batch_size
        self.num_steps = num_steps = FLAGS.num_steps
        self.epoch_size = ((len(data) // batch_size) - 1) // num_steps
        self.input_data, self.targets = reader.ptb_producer(
            data, batch_size, num_steps, name=name)
项目:ActionRecognition    作者:woodfrog    | 项目源码 | 文件源码
def __init__(self, config, data, name=None):
        '''
          num_steps: the number of timesteps (or unrolled steps)

        '''
        self.batch_size = batch_size = config.batch_size
        self.num_steps = num_steps = config.num_steps
        self.epoch_size = ((len(data) // batch_size) - 1) // num_steps
        self.input_data, self.targets = reader.ptb_producer(
            data, batch_size, num_steps, name=name)