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
apex
Commits
2361a646
Commit
2361a646
authored
Oct 07, 2018
by
Michael Carilli
Browse files
Updating imagenet FP16_Optimizer example for new syntax
parent
e4c97f32
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
examples/imagenet/main_fp16_optimizer.py
examples/imagenet/main_fp16_optimizer.py
+5
-2
No files found.
examples/imagenet/main_fp16_optimizer.py
View file @
2361a646
...
@@ -128,8 +128,11 @@ def main():
...
@@ -128,8 +128,11 @@ def main():
if
args
.
fp16
:
if
args
.
fp16
:
model
=
network_to_half
(
model
)
model
=
network_to_half
(
model
)
if
args
.
distributed
:
if
args
.
distributed
:
# shared param turns off bucketing in DDP, for lower latency runs this can improve perf
# By default, apex.parallel.DistributedDataParallel overlaps communication with
model
=
DDP
(
model
,
shared_param
=
True
)
# computation in the backward pass.
# model = DDP(model)
# delay_allreduce delays all communication to the end of the backward pass.
model
=
DDP
(
model
,
delay_allreduce
=
True
)
# define loss function (criterion) and optimizer
# define loss function (criterion) and optimizer
criterion
=
nn
.
CrossEntropyLoss
().
cuda
()
criterion
=
nn
.
CrossEntropyLoss
().
cuda
()
...
...
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