WeightedRandomSampler in PyTorch_Geometric Dataloader

Hello everyone,

I am writing a program to perform graph classification using PyTorch Geometric, however I have a very imbalanced dataset. I was wondering if I can easily implement a method like WeightedRandomSampler in normal PyTorch?

Thanks in advance!

I’m not familiar with PyTorch Geometric, but in case you can precompute the targets and each sample has one corresponding target class, you could take a look at this code snippet, which explains the usage of the WeightedRandomSampler.