pyg-team/pytorch_geometric

Provide a helper for easier batching

Open

#70 aperta il 10 gen 2019

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)Python (3514 fork)batch import
2 - Priority P2featurehelp wantedloader

Metriche repository

Star
 (19.985 star)
Metriche merge PR
 (Merge medio 35g 1h) (14 PR mergiate in 30 g)

Descrizione

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

Guida contributor