(m)
| 555 | """ |
| 556 | |
| 557 | def _init_weights(m): |
| 558 | if isinstance(m, nn.Linear): |
| 559 | trunc_normal_(m.weight, std=.02) |
| 560 | if isinstance(m, nn.Linear) and m.bias is not None: |
| 561 | nn.init.constant_(m.bias, 0) |
| 562 | elif isinstance(m, nn.LayerNorm): |
| 563 | nn.init.constant_(m.bias, 0) |
| 564 | nn.init.constant_(m.weight, 1.0) |
| 565 | |
| 566 | if isinstance(pretrained, str): |
| 567 | self.apply(_init_weights) |
nothing calls this directly
no outgoing calls
no test coverage detected