dgl.sparse.SparseMatrix.double
- SparseMatrix.double()[source]
将矩阵值转换为双精度数据类型。如果矩阵已经使用双精度数据类型,将返回原始矩阵。
- Returns:
具有双精度值的矩阵
- Return type:
示例
>>> indices = torch.tensor([[1, 1, 2], [1, 2, 0]]) >>> A = dglsp.spmatrix(indices, shape=(3, 4)) >>> A.double() SparseMatrix(indices=tensor([[1, 1, 2], [1, 2, 0]]), values=tensor([1., 1., 1.], dtype=torch.float64), shape=(3, 4), nnz=3)