Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
286bacf2
Commit
286bacf2
authored
Jun 13, 2017
by
ngovanmao
Browse files
Fix a small bug of Python3 compatibility in tutorial example /rnn/ptb
parent
62b33958
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
tutorials/rnn/ptb/reader.py
tutorials/rnn/ptb/reader.py
+5
-1
No files found.
tutorials/rnn/ptb/reader.py
View file @
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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment