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
78c38db4
Commit
78c38db4
authored
Aug 26, 2019
by
Du Xingjian
Committed by
mcarilli
Aug 25, 2019
Browse files
skip instancenorm in convert_syncbn_model (#438)
parent
880ab925
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
apex/parallel/__init__.py
apex/parallel/__init__.py
+2
-0
No files found.
apex/parallel/__init__.py
View file @
78c38db4
...
...
@@ -37,6 +37,8 @@ def convert_syncbn_model(module, process_group=None, channel_last=False):
>>> sync_bn_model = apex.parallel.convert_syncbn_model(model)
'''
mod
=
module
if
isinstance
(
module
,
torch
.
nn
.
modules
.
instancenorm
.
_InstanceNorm
):
return
module
if
isinstance
(
module
,
torch
.
nn
.
modules
.
batchnorm
.
_BatchNorm
):
mod
=
SyncBatchNorm
(
module
.
num_features
,
module
.
eps
,
module
.
momentum
,
module
.
affine
,
module
.
track_running_stats
,
process_group
,
channel_last
=
channel_last
)
mod
.
running_mean
=
module
.
running_mean
...
...
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