Using custom collate_fn with PyG DataLoader #3426
-
👋 I wonder if anyone can share how to use a custom I'd be interested in hearing of any other solutions. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
That line you are referring to removes user defined collate functions, the dataloader instead uses a inbuilt collate function to collate graphs, refer to this line. Now you could modify the "behaviour" of the default collate function by over-ridding the |
Beta Was this translation helpful? Give feedback.
-
Thanks both for the helpful answers. I think for my use case the I had the idea of adding an optional |
Beta Was this translation helpful? Give feedback.
That line you are referring to removes user defined collate functions, the dataloader instead uses a inbuilt collate function to collate graphs, refer to this line.
Now you could modify the "behaviour" of the default collate function by over-ridding the
__inc__
and__cat_dim__
functions as described (here)[https://pytorch-geometric.readthedocs.io/en/latest/notes/batching.html#pairs-of-graphs]. Now if that too doesn't fit your use case you'll have to write a customdataloader
with your owncollate
function.