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