MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / __init__

Method __init__

semantic_sam/body/decoder/modules.py:14–25  ·  view source on GitHub ↗
(self, d_model, nhead, dropout=0.0,
                 activation="relu", normalize_before=False)

Source from the content-addressed store, hash-verified

12class 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():

Callers

nothing calls this directly

Calls 3

_reset_parametersMethod · 0.95
_get_activation_fnFunction · 0.70
__init__Method · 0.45

Tested by

no test coverage detected