dgl.sparse.DiagMatrix.float

DiagMatrix.float()[source]

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

Returns

The matrix with float values

Return type

DiagMatrix

Examples

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