(self, d_model, nhead, dropout=0.0,
activation="relu", normalize_before=False)
| 12 | class SelfAttentionLayer(nn.Module): |
| 13 | |
| 14 | def __init__(self, d_model, nhead, dropout=0.0, |
| 15 | activation="relu", normalize_before=False): |
| 16 | super().__init__() |
| 17 | self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) |
| 18 | |
| 19 | self.norm = nn.LayerNorm(d_model) |
| 20 | self.dropout = nn.Dropout(dropout) |
| 21 | |
| 22 | self.activation = _get_activation_fn(activation) |
| 23 | self.normalize_before = normalize_before |
| 24 | |
| 25 | self._reset_parameters() |
| 26 | |
| 27 | def _reset_parameters(self): |
| 28 | for p in self.parameters(): |
nothing calls this directly
no test coverage detected