(self, x, cross, x_mask=None, cross_mask=None)
| 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( |
| 199 | x, x, x, |
| 200 | attn_mask=x_mask |
| 201 | )[0]) |
| 202 | |
| 203 | x, trend1 = self.decomp1(x) |
| 204 | x = x + self.dropout(self.cross_attention( |
| 205 | x, cross, cross, |
| 206 | attn_mask=cross_mask |
| 207 | )[0]) |
| 208 | |
| 209 | x, trend2 = self.decomp2(x) |
| 210 | y = x |
| 211 | y = self.dropout(self.activation(self.conv1(y.transpose(-1, 1)))) |
| 212 | y = self.dropout(self.conv2(y).transpose(-1, 1)) |
| 213 | x, trend3 = self.decomp3(x + y) |
| 214 | |
| 215 | residual_trend = trend1 + trend2 + trend3 |
| 216 | residual_trend = self.projection(residual_trend.permute(0, 2, 1)).transpose(1, 2) |
| 217 | return x, residual_trend |
| 218 | |
| 219 | |
| 220 | class Decoder(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected