dgl.sparse.SparseMatrix.double

SparseMatrix.double()[source]

Converts the matrix values to double data type. If the matrix already uses double data type, the original matrix will be returned.

Returns

The matrix with double values

Return type

SparseMatrix

Examples

>>> 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)