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
MMCV
Commits
b11c5660
"docs/source/vscode:/vscode.git/clone" did not exist on "2214acbe1bf7fe0c02d7c2a795c89aa4736599c5"
Unverified
Commit
b11c5660
authored
Jul 07, 2020
by
Kai Chen
Committed by
GitHub
Jul 07, 2020
Browse files
fix syncbn when dist is unavailabel (#388)
parent
b2b42cbd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
85 deletions
+96
-85
mmcv/ops/sync_bn.py
mmcv/ops/sync_bn.py
+96
-85
No files found.
mmcv/ops/sync_bn.py
View file @
b11c5660
...
...
@@ -109,7 +109,9 @@ class SyncBatchNormFunction(Function):
None
,
None
,
None
,
None
class
SyncBatchNorm
(
Module
):
if
dist
.
is_available
():
class
SyncBatchNorm
(
Module
):
def
__init__
(
self
,
num_features
,
...
...
@@ -175,8 +177,8 @@ class SyncBatchNorm(Module):
if
self
.
training
or
not
self
.
track_running_stats
:
return
SyncBatchNormFunction
.
apply
(
input
,
self
.
running_mean
,
self
.
running_var
,
self
.
weight
,
self
.
bias
,
self
.
running_var
,
self
.
weight
,
self
.
bias
,
exponential_average_factor
,
self
.
eps
,
self
.
group
,
self
.
group_size
)
...
...
@@ -194,3 +196,12 @@ class SyncBatchNorm(Module):
s
+=
f
'track_running_stats=
{
self
.
track_running_stats
}
, '
s
+=
f
'group_size=
{
self
.
group_size
}
)'
return
s
else
:
class
SyncBatchNorm
(
Module
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
raise
NotImplementedError
(
'SyncBatchNorm is not supported in this OS since the '
'distributed package is not available'
)
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