Machine learning LSTM批次与时间步长

Machine learning LSTM批次与时间步长,machine-learning,tensorflow,lstm,Machine Learning,Tensorflow,Lstm,我按照TensorFlow RNN教程创建了一个LSTM模型。然而,在这个过程中,我对“批次”和“时间步”之间的区别(如果有的话)感到困惑,我希望能帮助澄清这一问题 教程代码(见下文)基本上基于指定数量的步骤创建“批次”: with tf.variable_scope("RNN"): for time_step in range(num_steps): if time_step > 0: tf.get_variable_scope().reuse_variabl

我按照TensorFlow RNN教程创建了一个LSTM模型。然而,在这个过程中,我对“批次”和“时间步”之间的区别(如果有的话)感到困惑,我希望能帮助澄清这一问题

教程代码(见下文)基本上基于指定数量的步骤创建“批次”:

with tf.variable_scope("RNN"):
      for time_step in range(num_steps):
        if time_step > 0: tf.get_variable_scope().reuse_variables()
        (cell_output, state) = cell(inputs[:, time_step, :], state)
        outputs.append(cell_output)
但是,以下内容似乎也有相同的作用:

    for epoch in range(5):
        print('----- Epoch', epoch, '-----')
        total_loss = 0
        for i in range(inputs_cnt // BATCH_SIZE):
            inputs_batch = train_inputs[i * BATCH_SIZE: (i + 1) * BATCH_SIZE]
            orders_batch = train_orders[i * BATCH_SIZE: (i + 1) * BATCH_SIZE]
            feed_dict = {story: inputs_batch, order: orders_batch}

            logits, xent, loss = sess.run([...], feed_dict=feed_dict)

假设您正在处理文本,BATCH_SIZE将是并行处理的句子数,num_steps将是任何句子中的最大字数。这些是您输入到LSTM的不同维度