MCPcopy Create free account
hub / github.com/BorealisAI/scaleformer / __init__

Method __init__

layers/Autoformer_EncDec.py:174–195  ·  view source on GitHub ↗
(self, self_attention, cross_attention, d_model, c_out, d_ff=None,
                 moving_avg=25, dropout=0.1, activation="relu")

Source from the content-addressed store, hash-verified

172 Autoformer decoder layer with the progressive decomposition architecture
173 """
174 def __init__(self, self_attention, cross_attention, d_model, c_out, d_ff=None,
175 moving_avg=25, dropout=0.1, activation="relu"):
176 super(DecoderLayer, self).__init__()
177 d_ff = d_ff or 4 * d_model
178 self.self_attention = self_attention
179 self.cross_attention = cross_attention
180 self.conv1 = nn.Conv1d(in_channels=d_model, out_channels=d_ff, kernel_size=1, bias=False)
181 self.conv2 = nn.Conv1d(in_channels=d_ff, out_channels=d_model, kernel_size=1, bias=False)
182
183 if isinstance(moving_avg, list):
184 self.decomp1 = series_decomp_multi(moving_avg)
185 self.decomp2 = series_decomp_multi(moving_avg)
186 self.decomp3 = series_decomp_multi(moving_avg)
187 else:
188 self.decomp1 = series_decomp(moving_avg)
189 self.decomp2 = series_decomp(moving_avg)
190 self.decomp3 = series_decomp(moving_avg)
191
192 self.dropout = nn.Dropout(dropout)
193 self.projection = nn.Conv1d(in_channels=d_model, out_channels=c_out, kernel_size=3, stride=1, padding=1,
194 padding_mode='circular', bias=False)
195 self.activation = F.relu if activation == "relu" else F.gelu
196
197 def forward(self, x, cross, x_mask=None, cross_mask=None):
198 x = x + self.dropout(self.self_attention(

Callers

nothing calls this directly

Calls 3

series_decomp_multiClass · 0.85
series_decompClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected