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

Method __init__

models/MultiPatchFormer.py:26–50  ·  view source on GitHub ↗
(
        self,
        d_model: int,
        mha: AttentionLayer,
        d_hidden: int,
        dropout: float = 0,
        channel_wise=False,
    )

Source from the content-addressed store, hash-verified

24
25class Encoder(nn.Module):
26 def __init__(
27 self,
28 d_model: int,
29 mha: AttentionLayer,
30 d_hidden: int,
31 dropout: float = 0,
32 channel_wise=False,
33 ):
34 super(Encoder, self).__init__()
35
36 self.channel_wise = channel_wise
37 if self.channel_wise:
38 self.conv = torch.nn.Conv1d(
39 in_channels=d_model,
40 out_channels=d_model,
41 kernel_size=1,
42 stride=1,
43 padding=0,
44 padding_mode="reflect",
45 )
46 self.MHA = mha
47 self.feedforward = FeedForward(d_model=d_model, d_hidden=d_hidden)
48 self.dropout = torch.nn.Dropout(p=dropout)
49 self.layerNormal_1 = torch.nn.LayerNorm(d_model)
50 self.layerNormal_2 = torch.nn.LayerNorm(d_model)
51
52 def forward(self, x):
53 residual = x

Callers

nothing calls this directly

Calls 2

FeedForwardClass · 0.70
__init__Method · 0.45

Tested by

no test coverage detected