Skip to content

Commit

Permalink
FEA: add sparse tensor support for ngcf_conv and lightgcn_conv
Browse files Browse the repository at this point in the history
  • Loading branch information
downeykking committed Oct 23, 2023
1 parent fc37afc commit 8b4bf32
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions recbole_gnn/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,28 @@
from recbole.data.dataset import Dataset as RecBoleDataset
from recbole.utils import set_color, FeatureSource

import recbole
import pickle
from recbole.utils import ensure_dir


class GeneralGraphDataset(RecBoleDataset):
def __init__(self, config):
super().__init__(config)

if recbole.__version__ == "1.1.1":

def save(self):
"""Saving this :class:`Dataset` object to :attr:`config['checkpoint_dir']`."""
save_dir = self.config["checkpoint_dir"]
ensure_dir(save_dir)
file = os.path.join(save_dir, f'{self.config["dataset"]}-{self.__class__.__name__}.pth')
self.logger.info(
set_color("Saving filtered dataset into ", "pink") + f"[{file}]"
)
with open(file, "wb") as f:
pickle.dump(self, f)

@staticmethod
def edge_index_to_adj_t(edge_index, edge_weight, m_num_nodes, n_num_nodes):
adj = SparseTensor(row=edge_index[0],
Expand Down

0 comments on commit 8b4bf32

Please sign in to comment.