-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Thanks for sharing your code. I find some anomalous code In msdnet.py#L322.
these three "if branch" will not be excuted in func _init_weights(self, m).
MSDNet-PyTorch/models/msdnet.py
Lines 242 to 264 in c16a62b
| for m in self.blocks: | |
| if hasattr(m, '__iter__'): | |
| for _m in m: | |
| self._init_weights(_m) | |
| else: | |
| self._init_weights(m) | |
| for m in self.classifier: | |
| if hasattr(m, '__iter__'): | |
| for _m in m: | |
| self._init_weights(_m) | |
| else: | |
| self._init_weights(m) | |
| def _init_weights(self, m): | |
| if isinstance(m, nn.Conv2d): | |
| n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels | |
| m.weight.data.normal_(0, math.sqrt(2. / n)) | |
| elif isinstance(m, nn.BatchNorm2d): | |
| m.weight.data.fill_(1) | |
| m.bias.data.zero_() | |
| elif isinstance(m, nn.Linear): | |
| m.bias.data.zero_() |
Metadata
Metadata
Assignees
Labels
No labels