dgl.sparse.DiagMatrix.cpu

DiagMatrix.cpu()[source]

Moves the matrix to CPU. If the matrix is already on CPU, the original matrix will be returned.

Returns

The matrix on CPU

Return type

DiagMatrix

Examples

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