I am trying to create a dataloader based on a heterogenous graph built with PyG to be used in a model implemented in Pytorch Lightning. I tried to generate a dataloader with both HGTLoader and NeighborLoader but in both cases the output is an empty object.
To check if the dataloader creation process is working properly I created a toy graph as follows:
data= HeteroData(
user={x=[5, 1],},
poi={x=[10, 1] },
(user, visits, poi)={
edge_index=[2, 40],
edge_attr=[40, 2],
},
(poi, connects, poi)={
edge_index=[2, 100],
edge_attr=[100, 2],
}
)
with
poi_ids = (0,1,2,3,4,5,6,7,8,9)
user_ids = (10,11,12,13,14)
I have checked and all the edge_index elements are correctly indentified.
I tried to generate a dataloader with both HGTLoader and NeighborLoader but in both cases the output is an empty object. Consider that I want the user nodes as input nodes for the sampling.
Below the code of the two samplers.
data_loader = HGTLoader(
data,
batch_size=2,
input_nodes=('user', torch.tensor([10, 11, 12, 13,14], dtype=torch.long)),
num_samples={key: [2] for key in data.node_types},
shuffle=True,
)
data_loader= NeighborLoader(
data,
batch_size=2,
input_nodes=('user', torch.tensor([10, 11, 12, 13,14], dtype=torch.long)),
num_neighbors={key: [2] for key in data.edge_types},
shuffle=True)
Can anybody help me identify the problem? Many thanks!