【发布时间】:2017-02-02 19:41:42
【问题描述】:
我已按照 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)
【问题讨论】:
标签: machine-learning tensorflow lstm