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