MCPcopy Create free account
hub / github.com/cure-lab/LTSF-Linear / forward

Method forward

layers/Transformer_EncDec.py:60–78  ·  view source on GitHub ↗
(self, x, attn_mask=None)

Source from the content-addressed store, hash-verified

58 self.norm = norm_layer
59
60 def forward(self, x, attn_mask=None):
61 # x [B, L, D]
62 attns = []
63 if self.conv_layers is not None:
64 for attn_layer, conv_layer in zip(self.attn_layers, self.conv_layers):
65 x, attn = attn_layer(x, attn_mask=attn_mask)
66 x = conv_layer(x)
67 attns.append(attn)
68 x, attn = self.attn_layers[-1](x)
69 attns.append(attn)
70 else:
71 for attn_layer in self.attn_layers:
72 x, attn = attn_layer(x, attn_mask=attn_mask)
73 attns.append(attn)
74
75 if self.norm is not None:
76 x = self.norm(x)
77
78 return x, attns
79
80
81class DecoderLayer(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected