Ejemplo n.º 1
0
    def __init__(self, H, dataset, transform=None):
        super(CustomDataset, self).__init__('.', transform, None, None)
        adj = H.to_sparse()
        edge_index = adj._indices()
        data_list = []

        for i in range(0, len(dataset), 2):
            data = Data(edge_index=edge_index)
            data.x = dataset[i].t()
            data.y = dataset[i + 1].t()
            data_list.append(data)

        self.data, self.slices = self.collate(data_list)
Ejemplo n.º 2
0
    def __init__(self, H, dataset, x, fac_num, transform=None):
        super(CustomDataset, self).__init__('.', transform, None, None)
        adj = H.to_sparse()
        edge_index = adj._indices()
        data_list = []

        for row in dataset:
            data = Data(edge_index=edge_index)
            row = torch.cat([row.unsqueeze(0).t(),
                             torch.zeros(fac_num, 1)],
                            dim=0)
            data.x = row
            data.y = x.t()
            data_list.append(data)

        self.data, self.slices = self.collate(data_list)