(self, x, cross, x_mask=None, cross_mask=None)
| 159 | self.activation = F.relu if activation == "relu" else F.gelu |
| 160 | |
| 161 | def forward(self, x, cross, x_mask=None, cross_mask=None): |
| 162 | x = x + self.dropout(self.self_attention( |
| 163 | x, x, x, |
| 164 | attn_mask=x_mask |
| 165 | )[0]) |
| 166 | x, trend1 = self.decomp1(x) |
| 167 | x = x + self.dropout(self.cross_attention( |
| 168 | x, cross, cross, |
| 169 | attn_mask=cross_mask |
| 170 | )[0]) |
| 171 | x, trend2 = self.decomp2(x) |
| 172 | y = x |
| 173 | y = self.dropout(self.activation(self.conv1(y.transpose(-1, 1)))) |
| 174 | y = self.dropout(self.conv2(y).transpose(-1, 1)) |
| 175 | x, trend3 = self.decomp3(x + y) |
| 176 | |
| 177 | residual_trend = trend1 + trend2 + trend3 |
| 178 | residual_trend = self.projection(residual_trend.permute(0, 2, 1)).transpose(1, 2) |
| 179 | return x, residual_trend |
| 180 | |
| 181 | |
| 182 | class Decoder(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected