Datasets:

ArXiv:
FRGCF / base /torch_interface.py
kouke123's picture
Upload folder using huggingface_hub
8304f29 verified
raw
history blame contribute delete
322 Bytes
import torch
class TorchGraphInterface(object):
def __init__(self):
pass
@staticmethod
def convert_sparse_mat_to_tensor(X):
coo = X.tocoo()
i = torch.LongTensor([coo.row, coo.col])
v = torch.from_numpy(coo.data).float()
return torch.sparse.FloatTensor(i, v, coo.shape)