pyg-team/pytorch_geometric

Provide a helper for easier batching

Open

#70 geöffnet am 10. Jan. 2019

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (3.514 Forks)batch import
2 - Priority P2featurehelp wantedloader

Repository-Metriken

Stars
 (19.985 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 35T 1h) (14 gemergte PRs in 30 T)

Beschreibung

DataLoader are handy in some situations however they do not cover all potential use cases. For now, I only found the following way of handling batches without them. Would it be possible to have a nice helper in native torch for this?

def forward(self, x, edge_index):
        batch_size, n_size = x.shape[:2]
        batch = [torch_geometric.data.Data(x=t, edge_index=edge_index) for t in x]
        batch = torch_geometric.data.Batch.from_data_list(batch)
        x = self.net(batch.x, batch.edge_index).view(batch_size, n_size, 1)
        return x

Contributor Guide