Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
4de54e62
Commit
4de54e62
authored
Dec 22, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PTB] allow any number of layers (fix #567)
parent
2b2e12ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
examples/PennTreebank/PTB-LSTM.py
examples/PennTreebank/PTB-LSTM.py
+5
-5
No files found.
examples/PennTreebank/PTB-LSTM.py
View file @
4de54e62
...
...
@@ -80,11 +80,11 @@ class Model(ModelDesc):
outputs
,
last_state
=
rnn
.
static_rnn
(
cell
,
input_list
,
state_var
,
scope
=
'rnn'
)
# update the hidden state after a rnn loop completes
update_state_ops
=
[
tf
.
assign
(
state_var
[
0
]
.
c
,
last_state
[
0
]
.
c
),
tf
.
assign
(
state_var
[
0
]
.
h
,
last_state
[
0
]
.
h
),
tf
.
assign
(
state_var
[
1
]
.
c
,
last_state
[
1
]
.
c
),
tf
.
assign
(
state_var
[
1
]
.
h
,
last_state
[
1
]
.
h
)]
update_state_ops
=
[
]
for
k
in
range
(
NUM_LAYER
):
update_state_ops
.
extend
([
tf
.
assign
(
state_var
[
k
]
.
c
,
last_state
[
k
]
.
c
),
tf
.
assign
(
state_var
[
k
]
.
h
,
last_state
[
k
]
.
h
)])
# seqlen x (Bxrnnsize)
output
=
tf
.
reshape
(
tf
.
concat
(
outputs
,
1
),
[
-
1
,
HIDDEN_SIZE
])
# (Bxseqlen) x hidden
...
...
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