(self, self_attention, cross_attention, d_model, c_out, d_ff=None,
moving_avg=25, dropout=0.1, activation="relu")
| 114 | Autoformer decoder layer with the progressive decomposition architecture |
| 115 | """ |
| 116 | def __init__(self, self_attention, cross_attention, d_model, c_out, d_ff=None, |
| 117 | moving_avg=25, dropout=0.1, activation="relu"): |
| 118 | super(DecoderLayer, self).__init__() |
| 119 | d_ff = d_ff or 4 * d_model |
| 120 | self.self_attention = self_attention |
| 121 | self.cross_attention = cross_attention |
| 122 | self.conv1 = nn.Conv1d(in_channels=d_model, out_channels=d_ff, kernel_size=1, bias=False) |
| 123 | self.conv2 = nn.Conv1d(in_channels=d_ff, out_channels=d_model, kernel_size=1, bias=False) |
| 124 | self.decomp1 = series_decomp(moving_avg) |
| 125 | self.decomp2 = series_decomp(moving_avg) |
| 126 | self.decomp3 = series_decomp(moving_avg) |
| 127 | self.dropout = nn.Dropout(dropout) |
| 128 | self.projection = nn.Conv1d(in_channels=d_model, out_channels=c_out, kernel_size=3, stride=1, padding=1, |
| 129 | padding_mode='circular', bias=False) |
| 130 | self.activation = F.relu if activation == "relu" else F.gelu |
| 131 | |
| 132 | def forward(self, x, cross, x_mask=None, cross_mask=None): |
| 133 | x = x + self.dropout(self.self_attention( |
nothing calls this directly
no test coverage detected