MCPcopy Create free account
hub / github.com/FunAudioLLM/FunMusic / __init__

Method __init__

inspiremusic/transformer/decoder_layer.py:41–60  ·  view source on GitHub ↗

Construct an DecoderLayer object.

(
        self,
        size: int,
        self_attn: nn.Module,
        src_attn: Optional[nn.Module],
        feed_forward: nn.Module,
        dropout_rate: float,
        normalize_before: bool = True,
    )

Source from the content-addressed store, hash-verified

39 """
40
41 def __init__(
42 self,
43 size: int,
44 self_attn: nn.Module,
45 src_attn: Optional[nn.Module],
46 feed_forward: nn.Module,
47 dropout_rate: float,
48 normalize_before: bool = True,
49 ):
50 """Construct an DecoderLayer object."""
51 super().__init__()
52 self.size = size
53 self.self_attn = self_attn
54 self.src_attn = src_attn
55 self.feed_forward = feed_forward
56 self.norm1 = nn.LayerNorm(size, eps=1e-5)
57 self.norm2 = nn.LayerNorm(size, eps=1e-5)
58 self.norm3 = nn.LayerNorm(size, eps=1e-5)
59 self.dropout = nn.Dropout(dropout_rate)
60 self.normalize_before = normalize_before
61
62 def forward(
63 self,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected