dgl.sparse.DiagMatrix.cuda¶
-
DiagMatrix.
cuda
()[source]¶ Moves the matrix to GPU. If the matrix is already on GPU, the original matrix will be returned. If multiple GPU devices exist,
cuda:0
will be selected.- Returns
The matrix on GPU
- Return type
Examples
>>> val = torch.ones(2) >>> D = dglsp.diag(val) >>> D.cuda() DiagMatrix(values=tensor([1., 1.], device='cuda:0'), shape=(2, 2))