(self, occ, prc)
| 230 | self.A_dem = a_delta |
| 231 | |
| 232 | def forward(self, occ, prc): # occ.shape = [batch, node, seq] |
| 233 | x = torch.stack([occ, prc], dim=3) |
| 234 | x = self.encoder(x) |
| 235 | x = torch.squeeze(x) |
| 236 | x = self.act(self.linear(x)) |
| 237 | |
| 238 | # distance-based graph propagation |
| 239 | # l1 |
| 240 | x1 = self.distance_gcn_l1(x) |
| 241 | x1 = torch.matmul(self.A_dis, x1) |
| 242 | x1 = self.dropout(self.act(x1)) |
| 243 | # l2 |
| 244 | x1 = self.distance_gcn_l2(x1) |
| 245 | x1 = torch.matmul(self.A_dis, x1) |
| 246 | x1 = self.dropout(self.act(x1)) |
| 247 | # gru |
| 248 | x1 = x1.transpose(1, 2) |
| 249 | x1, _ = self.gru1(x1) |
| 250 | x1 = x1.transpose(1, 2) |
| 251 | |
| 252 | # demand-based graph propagation |
| 253 | # l1 |
| 254 | x2 = self.demand_gcn_l1(x) |
| 255 | x2 = torch.matmul(self.A_dem, x2) |
| 256 | x2 = self.dropout(self.act(x2)) |
| 257 | # l2 |
| 258 | x2 = self.demand_gcn_l2(x2) |
| 259 | x2 = torch.matmul(self.A_dem, x2) |
| 260 | x2 = self.dropout(self.act(x2)) |
| 261 | # gru |
| 262 | x2 = x2.transpose(1, 2) |
| 263 | x2, _ = self.gru2(x2) |
| 264 | x2 = x2.transpose(1, 2) |
| 265 | |
| 266 | # decode |
| 267 | output = self.alpha * x1 + (1-self.alpha) * x2 |
| 268 | output = self.decoder(output) |
| 269 | output = torch.squeeze(output) |
| 270 | return output |
| 271 | |
| 272 | |
| 273 | # https://arxiv.org/abs/2311.06190 |
nothing calls this directly
no outgoing calls
no test coverage detected