MCPcopy Create free account
hub / github.com/IntelligentSystemsLab/ST-EVCDP / forward

Method forward

baselines.py:169–190  ·  view source on GitHub ↗
(self, occ, prc)

Source from the content-addressed store, hash-verified

167 self.decoder = nn.Linear(self.seq, 1, device=device)
168
169 def forward(self, occ, prc): # occ.shape = [batch, node, seq]
170 x = torch.stack([occ, prc], dim=3)
171 x = self.encoder(x)
172 x = torch.squeeze(x)
173
174 # TPA
175 lstm_out, (_, _) = self.lstm(x) # b*n, s, 2
176 ht = lstm_out[:, -1, :] # ht
177 hw = lstm_out[:, :-1, :] # from h(t-1) to h1
178 hw = torch.transpose(hw, 1, 2)
179 Hc = self.fc1(hw)
180 Hn = self.fc2(Hc)
181 ht = torch.unsqueeze(ht, dim=2)
182 a = torch.bmm(Hn, ht)
183 a = torch.sigmoid(a)
184 a = torch.transpose(a, 1, 2)
185 vt = torch.matmul(a, Hc)
186 ht = torch.transpose(ht, 1, 2)
187 hx = torch.cat((vt, ht), dim=2)
188 y = self.fc3(hx)
189 print(y.shape)
190 return y
191
192
193# https://doi.org/10.1016/j.trc.2023.104205

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected