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
25a16a29
Commit
25a16a29
authored
Nov 21, 2017
by
Neal Wu
Browse files
Don't reuse the same cell when creating MultiRNNCell in ptb_word_lm.py
parent
a7f1c5ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
tutorials/rnn/ptb/ptb_word_lm.py
tutorials/rnn/ptb/ptb_word_lm.py
+7
-5
No files found.
tutorials/rnn/ptb/ptb_word_lm.py
View file @
25a16a29
...
...
@@ -213,13 +213,15 @@ class PTBModel(object):
# Slightly better results can be obtained with forget gate biases
# initialized to 1 but the hyperparameters of the model would need to be
# different than reported in the paper.
cell
=
self
.
_get_lstm_cell
(
config
,
is_training
)
if
is_training
and
config
.
keep_prob
<
1
:
cell
=
tf
.
contrib
.
rnn
.
DropoutWrapper
(
cell
,
output_keep_prob
=
config
.
keep_prob
)
def
make_cell
():
cell
=
self
.
_get_lstm_cell
(
config
,
is_training
)
if
is_training
and
config
.
keep_prob
<
1
:
cell
=
tf
.
contrib
.
rnn
.
DropoutWrapper
(
cell
,
output_keep_prob
=
config
.
keep_prob
)
return
cell
cell
=
tf
.
contrib
.
rnn
.
MultiRNNCell
(
[
cell
for
_
in
range
(
config
.
num_layers
)],
state_is_tuple
=
True
)
[
make_
cell
()
for
_
in
range
(
config
.
num_layers
)],
state_is_tuple
=
True
)
self
.
_initial_state
=
cell
.
zero_state
(
config
.
batch_size
,
data_type
())
state
=
self
.
_initial_state
...
...
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