Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DCRNN
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yan
DCRNN
Commits
b617e1a2
Commit
b617e1a2
authored
Aug 09, 2019
by
xlwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Amend the decoder output (leave out the first all zero time step)
parent
9a662cce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
dcrnn_model.py
model/dcrnn_model.py
+2
-1
dcrnn_trainer.py
trainer/dcrnn_trainer.py
+2
-2
No files found.
model/dcrnn_model.py
View file @
b617e1a2
...
...
@@ -173,7 +173,8 @@ class DCRNNModel(BaseModel):
context
,
_
=
self
.
encoder
(
source
,
init_hidden_state
)
# (num_layers, batch, outdim)
outputs
=
self
.
decoder
(
target
,
context
,
teacher_forcing_ratio
=
teacher_forcing_ratio
)
return
outputs
# (seq_length+1, batch_size, num_nodes*output_dim) (13, 50, 207*1)
# the elements of the first time step of the outputs are all zeros.
return
outputs
[
1
:,
:,
:]
# (seq_length, batch_size, num_nodes*output_dim) (12, 50, 207*1)
@property
def
batch_size
(
self
):
...
...
trainer/dcrnn_trainer.py
View file @
b617e1a2
...
...
@@ -122,8 +122,8 @@ class DCRNNTrainer(BaseTrainer):
data
,
target
=
data
.
to
(
self
.
device
),
target
.
to
(
self
.
device
)
output
=
self
.
model
(
data
,
target
,
0
)
output
=
torch
.
transpose
(
output
[
1
:]
.
view
(
12
,
self
.
model
.
batch_size
,
self
.
model
.
num_nodes
,
self
.
model
.
output_dim
),
0
,
1
)
# back to (50, 12, 207, 1)
output
=
torch
.
transpose
(
output
.
view
(
12
,
self
.
model
.
batch_size
,
self
.
model
.
num_nodes
,
self
.
model
.
output_dim
),
0
,
1
)
# back to (50, 12, 207, 1)
loss
=
self
.
loss
(
output
.
cpu
(),
label
)
...
...
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