benedekrozemberczki / pytorch_geometric_temporal

PyTorch Geometric Temporal: Spatiotemporal Signal Processing with Neural Machine Learning Models (CIKM 2021)
MIT License
2.62k stars 369 forks source link

The A3TGCN2 model in TemporalGNN does not handle varying edge_index for different batches? #153

Closed rperera12 closed 2 years ago

rperera12 commented 2 years ago

Hi, I posted this question on an Issue recently, but the Issue was Closed without a response. I am working with a case similar to the example from notebook: a3tgcn_for_traffic_forecasting.ipynb In this example provided in this repo:

x.shape = [batch_size, num_nodes, num_nodes_features, timesteps],
edge_index.shape = [2, num_edges]

In other words, for all time-steps in the input and for all batches the graph's edges remains static/unchanged. However, I am dealing with the case where for each time-step I will have a different edge_index. I can overcome the issue of time-step varying edge_index and/or batch varying edge_index using a zero padding approach. However, when I use the model provided here -- A3TGCN2 -- along with the provided class -- TemporalGNN -- , these do not include batches for edge_index. Is there a way to include batches for the edge_index as well in these model?

benedekrozemberczki commented 2 years ago

The issue was closed with a response. I recommend reading the documentation and looking at code.

rperera12 commented 2 years ago

Is there a specific part of the code/documentation you recommend reading? If you can point me in the right direction to allow edge_index to include batches dimension (edge_index.shape = [batches, 2, num_edges]) I'd really appreciate it.

benedekrozemberczki commented 2 years ago

GNNs do not have edge indices where [batches, 2, num_edges]. You have a batching index variable for segmentation. Look here: https://pytorch-geometric.readthedocs.io/en/latest/notes/introduction.html

benedekrozemberczki commented 2 years ago

You would have [2, num_edges] with the diagonal batch indexing trick and a segmentation index.