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
e4af2d90
Unverified
Commit
e4af2d90
authored
Oct 03, 2018
by
mcarilli
Committed by
GitHub
Oct 03, 2018
Browse files
Move gradient division to before the allreduce
This is consistent with upstream, and safer against overflow.
parent
2f204bca
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
apex/parallel/distributed.py
apex/parallel/distributed.py
+3
-3
No files found.
apex/parallel/distributed.py
View file @
e4af2d90
...
...
@@ -11,14 +11,14 @@ import copy
def
apply_flat_dist_call
(
bucket
,
call
,
extra_args
=
None
):
coalesced
=
_flatten_dense_tensors
(
bucket
)
if
call
is
dist
.
all_reduce
:
coalesced
/=
dist
.
get_world_size
()
if
extra_args
is
not
None
:
call
(
coalesced
,
*
extra_args
)
else
:
call
(
coalesced
)
if
call
is
dist
.
all_reduce
:
coalesced
/=
dist
.
get_world_size
()
for
buf
,
synced
in
zip
(
bucket
,
_unflatten_dense_tensors
(
coalesced
,
bucket
)):
buf
.
copy_
(
synced
)
...
...
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