(Torch Geometric) Issues With Batching

I am trying to use the Data and DataLoader specified by Torch Geometric; however, I’m running into issues with the size of my data. The size of edge_idx varies for each graph in my dataset as seen below:

[Data(x=[43, 10], y=[43, 10], edge_idx=[2, 90]), Data(x=[43, 10], y=[43, 10], edge_idx=[2, 88]), Data(x=[43, 10], y=[43, 10], edge_idx=[2, 92])]

Given data of this form, I follow the boilerplate template given here Creating Graph Datasets — pytorch_geometric documentation


from torch_geometric.data import Data
from torch_geometric.loader import DataLoader

data_list = [Data(...), ..., Data(...)]
loader = DataLoader(data_list, batch_size=32)

I get the following error, however:

RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 90 but got size 88 for tensor number 7 in the list.

This is confusing because the link specifies:

Here, adjacency matrices are stacked in a diagonal fashion (creating a giant graph that holds multiple isolated subgraphs), …

I know that I should be able to batch with differing edge_idx sizes per graph, I just don’t know how. Any help would be appreciated!