dgl.sparse.DiagMatrix.int

DiagMatrix.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

DiagMatrix

Examples

>>> val = torch.ones(2)
>>> D = dglsp.diag(val)
>>> D.int()
DiagMatrix(values=tensor([1, 1], dtype=torch.int32),
           shape=(2, 2))