ValueError: expected sequence of length 4 at dim 2 (got 0)
Leon-0919 opened this issue · 0 comments
Leon-0919 commented
def dense_from_coo(shape, conns, dtype=torch.float64):
mat = torch.zeros(shape, dtype=dtype)
idxs, weights = conns
if len(idxs) == 0:
return mat
rows, cols = np.array(idxs).transpose()
mat[torch.LongTensor(rows), torch.LongTensor(cols)] = torch.tensor(
weights, dtype=dtype)
return mat
after changing torch.tensor to torch.longTensor. This error pops up.
Torch version 1.17