Skip to content
Discussion options

You must be logged in to vote

Update: it seems the user input collate_fn is always discarded in torch_geometric.loader.DataLoader as stated here: #3426.

I have tried to overcome this by the following:

  1. Copy and paste the whole DataLoader from here: https://github.com/pyg-team/pytorch_geometric/blob/master/torch_geometric/loader/dataloader.py#L71
  2. Directly adjust the padding logic inside collate_fn:
class Collater:
    ...
    def collate_fn(self, batch: List[Any]) -> Any:
        if isinstance(self.dataset, OnDiskDataset):
            return self(self.dataset.multi_get(batch))

        # additional padding logic
        max_num_nodes = max(graph.x.shape[0] for graph in batch)
        new_batch = []
        for graph i…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@rusty1s
Comment options

@vietngth
Comment options

Answer selected by vietngth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants