Update modeling_diffusiondet.py
Browse files- modeling_diffusiondet.py +2 -2
modeling_diffusiondet.py
CHANGED
|
@@ -129,8 +129,8 @@ class DiffusionDet(PreTrainedModel):
|
|
| 129 |
def _init_weights(self, module):
|
| 130 |
if isinstance(module, nn.Linear) or isinstance(module, nn.Conv2d):
|
| 131 |
torch.nn.init.kaiming_normal_(module.weight, mode='fan_in', nonlinearity='relu')
|
| 132 |
-
|
| 133 |
-
|
| 134 |
elif isinstance(module, nn.BatchNorm2d):
|
| 135 |
torch.nn.init.constant_(module.weight, 1)
|
| 136 |
torch.nn.init.constant_(module.bias, 0)
|
|
|
|
| 129 |
def _init_weights(self, module):
|
| 130 |
if isinstance(module, nn.Linear) or isinstance(module, nn.Conv2d):
|
| 131 |
torch.nn.init.kaiming_normal_(module.weight, mode='fan_in', nonlinearity='relu')
|
| 132 |
+
if module.bias is not None:
|
| 133 |
+
torch.nn.init.constant_(module.bias, 0)
|
| 134 |
elif isinstance(module, nn.BatchNorm2d):
|
| 135 |
torch.nn.init.constant_(module.weight, 1)
|
| 136 |
torch.nn.init.constant_(module.bias, 0)
|