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

Method forward

LDPS_Graph/models/DLinear.py:72–87  ·  view source on GitHub ↗
(self, x,edge_index=None, edge_attr=None)

Source from the content-addressed store, hash-verified

70 # self.Linear_Trend.weight = nn.Parameter((1/self.seq_len)*torch.ones([self.pred_len,self.seq_len]))
71
72 def forward(self, x,edge_index=None, edge_attr=None):
73 # x: [Batch, Input length, Channel]
74 seasonal_init, trend_init = self.decompsition(x)
75 seasonal_init, trend_init = seasonal_init.permute(0,2,1), trend_init.permute(0,2,1)
76 if self.individual:
77 seasonal_output = torch.zeros([seasonal_init.size(0),seasonal_init.size(1),self.pred_len],dtype=seasonal_init.dtype).to(seasonal_init.device)
78 trend_output = torch.zeros([trend_init.size(0),trend_init.size(1),self.pred_len],dtype=trend_init.dtype).to(trend_init.device)
79 for i in range(self.channels):
80 seasonal_output[:,i,:] = self.Linear_Seasonal[i](seasonal_init[:,i,:])
81 trend_output[:,i,:] = self.Linear_Trend[i](trend_init[:,i,:])
82 else:
83 seasonal_output = self.Linear_Seasonal(seasonal_init)
84 trend_output = self.Linear_Trend(trend_init)
85
86 x = seasonal_output + trend_output
87 return x.permute(0,2,1) # to [Batch, Output length, Channel]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected