(m)
| 443 | """ |
| 444 | |
| 445 | def _init_weights(m): |
| 446 | if isinstance(m, nn.Linear): |
| 447 | trunc_normal_(m.weight, std=.02) |
| 448 | if isinstance(m, nn.Linear) and m.bias is not None: |
| 449 | nn.init.constant_(m.bias, 0) |
| 450 | elif isinstance(m, nn.LayerNorm): |
| 451 | nn.init.constant_(m.bias, 0) |
| 452 | nn.init.constant_(m.weight, 1.0) |
| 453 | |
| 454 | if isinstance(pretrained, str): |
| 455 | self.apply(_init_weights) |
nothing calls this directly
no outgoing calls
no test coverage detected