matrix = torch.sparse_coo_tensor(index, v).to_dense()returnmatrix 開發者ID:iMoonLab,項目名稱:THU-DeepHypergraph,代碼行數:10,代碼來源:structure_convert.py 示例14: sparse_repeat ▲點讚 5▼ # 需要導入模塊: import torch [as 別名]# 或者: from torch importsparse_coo_tensor[as 別名]defsparse_...
Source File: structure_convert.py From THU-DeepHypergraph with MIT License 5 votes def index2matrix(index): assert index.size(0) == 2 index = index.long() v_len = index.size(1) v = torch.ones(v_len).float() matrix = torch.sparse_coo_tensor(index, v).to_dense() return matrix...