pyg-team/pytorch_geometric

Provide a helper for easier batching

Open

#70 建立於 2019年1月10日

在 GitHub 查看
 (4 留言) (0 反應) (0 負責人)Python (3,514 fork)batch import
2 - Priority P2featurehelp wantedloader

倉庫指標

Star
 (19,985 star)
PR 合併指標
 (平均合併 35天 1小時) (30 天內合併 14 個 PR)

描述

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

貢獻者指南