(module, initialization)
| 275 | |
| 276 | # Cell |
| 277 | def _init_weights(module, initialization): |
| 278 | if type(module) == t.nn.Linear: |
| 279 | if initialization == 'orthogonal': |
| 280 | t.nn.init.orthogonal_(module.weight) |
| 281 | elif initialization == 'he_uniform': |
| 282 | t.nn.init.kaiming_uniform_(module.weight) |
| 283 | elif initialization == 'he_normal': |
| 284 | t.nn.init.kaiming_normal_(module.weight) |
| 285 | elif initialization == 'glorot_uniform': |
| 286 | t.nn.init.xavier_uniform_(module.weight) |
| 287 | elif initialization == 'glorot_normal': |
| 288 | t.nn.init.xavier_normal_(module.weight) |
| 289 | elif initialization == 'lecun_normal': |
| 290 | pass #t.nn.init.normal_(module.weight, 0.0, std=1/np.sqrt(module.weight.numel())) |
| 291 | else: |
| 292 | assert 1<0, f'Initialization {initialization} not found' |
| 293 | |
| 294 | # Cell |
| 295 | ACTIVATIONS = ['ReLU', |
nothing calls this directly
no outgoing calls
no test coverage detected