MCPcopy Create free account
hub / github.com/thuml/Time-Series-Library / forward

Method forward

models/MultiPatchFormer.py:52–71  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

50 self.layerNormal_2 = torch.nn.LayerNorm(d_model)
51
52 def forward(self, x):
53 residual = x
54 q = residual
55 if self.channel_wise:
56 x_r = self.conv(x.permute(0, 2, 1)).transpose(1, 2)
57 k = x_r
58 v = x_r
59 else:
60 k = residual
61 v = residual
62 x, score = self.MHA(q, k, v, attn_mask=None)
63 x = self.dropout(x)
64 x = self.layerNormal_1(x + residual)
65
66 residual = x
67 x = self.feedforward(residual)
68 x = self.dropout(x)
69 x = self.layerNormal_2(x + residual)
70
71 return x, score
72
73
74class Model(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected