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

Method forward

LDPS_Graph/layers/Autoformer_EncDec.py:151–169  ·  view source on GitHub ↗
(self, x, cross, x_mask=None, cross_mask=None)

Source from the content-addressed store, hash-verified

149 self.activation = F.relu if activation == "relu" else F.gelu
150
151 def forward(self, x, cross, x_mask=None, cross_mask=None):
152 x = x + self.dropout(self.self_attention(
153 x, x, x,
154 attn_mask=x_mask
155 )[0])
156 x, trend1 = self.decomp1(x)
157 x = x + self.dropout(self.cross_attention(
158 x, cross, cross,
159 attn_mask=cross_mask
160 )[0])
161 x, trend2 = self.decomp2(x)
162 y = x
163 y = self.dropout(self.activation(self.conv1(y.transpose(-1, 1))))
164 y = self.dropout(self.conv2(y).transpose(-1, 1))
165 x, trend3 = self.decomp3(x + y)
166
167 residual_trend = trend1 + trend2 + trend3
168 residual_trend = self.projection(residual_trend.permute(0, 2, 1)).transpose(1, 2)
169 return x, residual_trend
170
171
172class Decoder(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected