Commit 8faea40d authored by zsc's avatar zsc Committed by Yuxin Wu

Fix PTB example according to upstream changes (#322)

* Fix for python3, as the iterator returned by the map will be empty after logging.

* Fix PTB example according to upstream changes.
parent 96fdb83c
......@@ -54,10 +54,13 @@ class Model(ModelDesc):
input, nextinput = inputs
initializer = tf.random_uniform_initializer(-0.05, 0.05)
cell = rnn.BasicLSTMCell(num_units=HIDDEN_SIZE, forget_bias=0.0)
def get_basic_cell():
cell = rnn.BasicLSTMCell(num_units=HIDDEN_SIZE, forget_bias=0.0, reuse=tf.get_variable_scope().reuse)
if is_training:
cell = rnn.DropoutWrapper(cell, output_keep_prob=DROPOUT)
cell = rnn.MultiRNNCell([cell] * NUM_LAYER)
return cell
cell = rnn.MultiRNNCell([get_basic_cell() for _ in range(NUM_LAYER)])
def get_v(n):
return tf.get_variable(n, [BATCH, HIDDEN_SIZE],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment