MCPcopy Create free account
hub / github.com/Anoise/WTFlib / __init__

Method __init__

LDPS_Graph/layers/Transformer_EncDec.py:82–94  ·  view source on GitHub ↗
(self, self_attention, cross_attention, d_model, d_ff=None,
                 dropout=0.1, activation="relu")

Source from the content-addressed store, hash-verified

80
81class DecoderLayer(nn.Module):
82 def __init__(self, self_attention, cross_attention, d_model, d_ff=None,
83 dropout=0.1, activation="relu"):
84 super(DecoderLayer, self).__init__()
85 d_ff = d_ff or 4 * d_model
86 self.self_attention = self_attention
87 self.cross_attention = cross_attention
88 self.conv1 = nn.Conv1d(in_channels=d_model, out_channels=d_ff, kernel_size=1)
89 self.conv2 = nn.Conv1d(in_channels=d_ff, out_channels=d_model, kernel_size=1)
90 self.norm1 = nn.LayerNorm(d_model)
91 self.norm2 = nn.LayerNorm(d_model)
92 self.norm3 = nn.LayerNorm(d_model)
93 self.dropout = nn.Dropout(dropout)
94 self.activation = F.relu if activation == "relu" else F.gelu
95
96 def forward(self, x, cross, x_mask=None, cross_mask=None):
97 x = x + self.dropout(self.self_attention(

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected