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
OpenDAS
OpenPCDet
Commits
53cbe187
"tools/vscode:/vscode.git/clone" did not exist on "e0bc968256b3f9eafb0f0953bd0b02cdf1d09e2b"
Commit
53cbe187
authored
Aug 17, 2022
by
jihanyang
Browse files
Modify the timing manner of data timer and forward timer
parent
57b19553
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
tools/train_utils/train_utils.py
tools/train_utils/train_utils.py
+5
-5
No files found.
tools/train_utils/train_utils.py
View file @
53cbe187
...
...
@@ -19,8 +19,8 @@ def train_one_epoch(model, optimizer, train_loader, model_func, lr_scheduler, ac
batch_time
=
common_utils
.
AverageMeter
()
forward_time
=
common_utils
.
AverageMeter
()
for
cur_it
in
range
(
total_it_each_epoch
):
end
=
time
.
time
()
for
cur_it
in
range
(
total_it_each_epoch
):
try
:
batch
=
next
(
dataloader_iter
)
except
StopIteration
:
...
...
@@ -46,16 +46,16 @@ def train_one_epoch(model, optimizer, train_loader, model_func, lr_scheduler, ac
loss
,
tb_dict
,
disp_dict
=
model_func
(
model
,
batch
)
forward_timer
=
time
.
time
()
cur_forward_time
=
forward_timer
-
data_timer
loss
.
backward
()
clip_grad_norm_
(
model
.
parameters
(),
optim_cfg
.
GRAD_NORM_CLIP
)
optimizer
.
step
()
accumulated_iter
+=
1
cur_forward_time
=
time
.
time
()
-
data_timer
cur_batch_time
=
time
.
time
()
-
end
end
=
time
.
time
()
# average reduce
avg_data_time
=
commu_utils
.
average_reduce_value
(
cur_data_time
)
avg_forward_time
=
commu_utils
.
average_reduce_value
(
cur_forward_time
)
...
...
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