We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9364c8e commit d28ec48Copy full SHA for d28ec48
torchvision/models/resnet.py
@@ -217,9 +217,9 @@ def __init__(
217
# This improves the model by 0.2~0.3% according to https://arxiv.org/abs/1706.02677
218
if zero_init_residual:
219
for m in self.modules():
220
- if isinstance(m, Bottleneck):
+ if isinstance(m, Bottleneck) and m.bn3.weight is not None:
221
nn.init.constant_(m.bn3.weight, 0) # type: ignore[arg-type]
222
- elif isinstance(m, BasicBlock):
+ elif isinstance(m, BasicBlock) and m.bn2.weight is not None:
223
nn.init.constant_(m.bn2.weight, 0) # type: ignore[arg-type]
224
225
def _make_layer(
0 commit comments