Initialize the weights in backbone. Args: pretrained (str, optional): Path to pre-trained weights. Defaults to None.
(self, pretrained=None)
| 644 | param.requires_grad = False |
| 645 | |
| 646 | def init_weights(self, pretrained=None): |
| 647 | """Initialize the weights in backbone. |
| 648 | Args: |
| 649 | pretrained (str, optional): Path to pre-trained weights. |
| 650 | Defaults to None. |
| 651 | """ |
| 652 | |
| 653 | def _init_weights(m): |
| 654 | if isinstance(m, nn.Linear): |
| 655 | trunc_normal_(m.weight, std=0.02) |
| 656 | if isinstance(m, nn.Linear) and m.bias is not None: |
| 657 | nn.init.constant_(m.bias, 0) |
| 658 | elif isinstance(m, nn.LayerNorm): |
| 659 | nn.init.constant_(m.bias, 0) |
| 660 | nn.init.constant_(m.weight, 1.0) |
| 661 | |
| 662 | |
| 663 | def load_weights(self, pretrained_dict=None, pretrained_layers=[], verbose=True): |
nothing calls this directly
no outgoing calls
no test coverage detected