Commit 50257111 authored by Greg Price's avatar Greg Price Committed by Neal Wu
Browse files

tutorials/rnn/ptb: Small fix to make Python 3-compatible. (#2403)

parent 66d20d87
...@@ -252,7 +252,7 @@ class PTBModel(object): ...@@ -252,7 +252,7 @@ class PTBModel(object):
ops.update(lr=self._lr, new_lr=self._new_lr, lr_update=self._lr_update) ops.update(lr=self._lr, new_lr=self._new_lr, lr_update=self._lr_update)
if self._rnn_params: if self._rnn_params:
ops.update(rnn_params=self._rnn_params) ops.update(rnn_params=self._rnn_params)
for name, op in ops.iteritems(): for name, op in ops.items():
tf.add_to_collection(name, op) tf.add_to_collection(name, op)
self._initial_state_name = util.with_prefix(self._name, "initial") self._initial_state_name = util.with_prefix(self._name, "initial")
self._final_state_name = util.with_prefix(self._name, "final") self._final_state_name = util.with_prefix(self._name, "final")
...@@ -484,7 +484,7 @@ def main(_): ...@@ -484,7 +484,7 @@ def main(_):
input_=test_input) input_=test_input)
models = {"Train": m, "Valid": mvalid, "Test": mtest} models = {"Train": m, "Valid": mvalid, "Test": mtest}
for name, model in models.iteritems(): for name, model in models.items():
model.export_ops(name) model.export_ops(name)
metagraph = tf.train.export_meta_graph() metagraph = tf.train.export_meta_graph()
if tf.__version__ < "1.1.0" and FLAGS.num_gpus > 1: if tf.__version__ < "1.1.0" and FLAGS.num_gpus > 1:
......
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