Commit bc86a539 authored by Toby Boyd's avatar Toby Boyd Committed by GitHub
Browse files

Merge pull request #2259 from skwbc/str_decode_py3

bugfix for rnn tutorial on Python3
parents 55e6e387 812bc2e7
...@@ -25,10 +25,14 @@ import sys ...@@ -25,10 +25,14 @@ import sys
import tensorflow as tf import tensorflow as tf
Py3 = sys.version_info[0] == 3
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 Py3:
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