(m)
| 458 | """ |
| 459 | |
| 460 | def _init_weights(m): |
| 461 | if isinstance(m, nn.Linear): |
| 462 | trunc_normal_(m.weight, std=.02) |
| 463 | if isinstance(m, nn.Linear) and m.bias is not None: |
| 464 | nn.init.constant_(m.bias, 0) |
| 465 | elif isinstance(m, nn.LayerNorm): |
| 466 | nn.init.constant_(m.bias, 0) |
| 467 | nn.init.constant_(m.weight, 1.0) |
| 468 | |
| 469 | if isinstance(pretrained, str): |
| 470 | self.apply(_init_weights) |
nothing calls this directly
no outgoing calls
no test coverage detected