Commit 8e8f37e5 authored by Lukasz Kaiser's avatar Lukasz Kaiser Committed by GitHub
Browse files

Merge pull request #1548 from ngovanmao/maongo_dev

Fix a small bug of Python3 compatibility in tutorial example /rnn/ptb
parents c998779e 286bacf2
...@@ -21,13 +21,17 @@ from __future__ import print_function ...@@ -21,13 +21,17 @@ from __future__ import print_function
import collections import collections
import os import os
import sys
import tensorflow as tf import tensorflow as tf
def _read_words(filename): def _read_words(filename):
with tf.gfile.GFile(filename, "r") as f: with tf.gfile.GFile(filename, "r") as f:
return f.read().decode("utf-8").replace("\n", "<eos>").split() if sys.version_info[0] >= 3:
return f.read().replace("\n", "<eos>").split()
else:
return f.read().decode("utf-8").replace("\n", "<eos>").split()
def _build_vocab(filename): def _build_vocab(filename):
......
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