Spaces:
Sleeping
Sleeping
Qihang Yu
commited on
Commit
·
f395a55
1
Parent(s):
40177ed
Add kMaX-DeepLab
Browse files
kmax_deeplab/modeling/pixel_decoder/kmax_pixel_decoder.py
CHANGED
|
@@ -31,8 +31,29 @@ def get_activation(name):
|
|
| 31 |
|
| 32 |
class SyncBNCPU(nn.SyncBatchNorm):
|
| 33 |
def forward(self, input):
|
| 34 |
-
self.
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
def get_norm(name, channels):
|
| 38 |
if name is None or name.lower() == 'none':
|
|
|
|
| 31 |
|
| 32 |
class SyncBNCPU(nn.SyncBatchNorm):
|
| 33 |
def forward(self, input):
|
| 34 |
+
self._check_input_dim(input)
|
| 35 |
+
self._check_non_zero_input_channels(input)
|
| 36 |
+
if self.momentum is None:
|
| 37 |
+
exponential_average_factor = 0.0
|
| 38 |
+
else:
|
| 39 |
+
exponential_average_factor = self.momentum
|
| 40 |
+
bn_training = False
|
| 41 |
+
|
| 42 |
+
running_mean = self.running_mean
|
| 43 |
+
running_var = self.running_var
|
| 44 |
+
|
| 45 |
+
# fallback to framework BN when synchronization is not necessary
|
| 46 |
+
return F.batch_norm(
|
| 47 |
+
input,
|
| 48 |
+
running_mean,
|
| 49 |
+
running_var,
|
| 50 |
+
self.weight,
|
| 51 |
+
self.bias,
|
| 52 |
+
bn_training,
|
| 53 |
+
exponential_average_factor,
|
| 54 |
+
self.eps,
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
|
| 58 |
def get_norm(name, channels):
|
| 59 |
if name is None or name.lower() == 'none':
|