dgl.sparse.SparseMatrix.long¶
-
SparseMatrix.
long
()[source]¶ Converts the matrix values to long data type. If the matrix already uses long data type, the original matrix will be returned.
- Returns
The matrix with long values
- Return type
Examples
>>> indices = torch.tensor([[1, 1, 2], [1, 2, 0]]) >>> A = dglsp.spmatrix(indices, shape=(3, 4)) >>> A.long() SparseMatrix(indices=tensor([[1, 1, 2], [1, 2, 0]]), values=tensor([1, 1, 1]), shape=(3, 4), nnz=3)