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
9a662cce
Commit
9a662cce
authored
Aug 08, 2019
by
xlwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add elapsed time logging
parent
8473c700
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
dcrnn_trainer.py
trainer/dcrnn_trainer.py
+4
-4
No files found.
trainer/dcrnn_trainer.py
View file @
9a662cce
...
...
@@ -2,7 +2,7 @@ import numpy as np
import
torch
from
base
import
BaseTrainer
import
math
# from lib.utils import inf_loop
import
time
class
DCRNNTrainer
(
BaseTrainer
):
...
...
@@ -49,7 +49,7 @@ class DCRNNTrainer(BaseTrainer):
The metrics in log must have the key 'metrics'.
"""
self
.
model
.
train
()
start_time
=
time
.
time
()
total_loss
=
0
total_metrics
=
np
.
zeros
(
len
(
self
.
metrics
))
for
batch_idx
,
(
data
,
target
)
in
enumerate
(
self
.
data_loader
.
get_iterator
()):
...
...
@@ -90,7 +90,7 @@ class DCRNNTrainer(BaseTrainer):
log
=
{
'loss'
:
total_loss
/
self
.
len_epoch
,
'metrics'
:
(
total_metrics
/
self
.
len_epoch
)
.
tolist
()
'metrics'
:
(
total_metrics
/
self
.
len_epoch
)
.
tolist
()
,
}
if
self
.
do_validation
:
...
...
@@ -99,7 +99,7 @@ class DCRNNTrainer(BaseTrainer):
if
self
.
lr_scheduler
is
not
None
:
self
.
lr_scheduler
.
step
()
log
.
update
({
'Time'
:
"{:.4f}s"
.
format
(
time
.
time
()
-
start_time
)})
return
log
def
_valid_epoch
(
self
,
epoch
):
...
...
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