Mismatch edge index with n-id for Neighborloader with ImbalancedSampler
🐛 Describe the bug
""" from torch_geometric.utils import to_dense_adj from torch_geometric.loader import NeighborLoader, ImbalancedSampler
target_dataset = 'ogbn-arxiv'
dataset = PygNodePropPredDataset(name=target_dataset, root='networks') data = dataset[0] split_idx = dataset.get_idx_split()
train_idx = split_idx['train'] valid_idx = split_idx['valid'] test_idx = split_idx['test']
train_sampler = ImbalancedSampler(data, input_nodes=train_idx) train_loader = NeighborLoader(data, input_nodes=train_idx, shuffle=True, num_workers=4, sampler=train_sampler, batch_size=args.batch_size, num_neighbors=[10,10] )
for batch in train_loader: adj = (to_dense_adj(batch.edge_index)[0]).numpy() print(adj.shape) print(batch.x.shape) """
Hi,
I met a problem when I used NeighborLoader with ImbalancedSampler.
When I checked the data in minibatch, I found that the batch.x has more nodes than adj matrix. I know there are some duplicate nodes in batch.x, but I don't know how to match the nodes in batch.x to batch.edge_index. (The batch.n_id doesn't work this problem, because n-id's length is same as batch.x's length)
Anyone meets the problem before?
Thank you
Thank you
Versions
..