Converts the matrix values to float32 data type. If the matrix already uses float data type, the original matrix will be returned. Returns ------- SparseMatrix The matrix with float values Examples -------- >>> indices = torch.te
(self)
| 341 | return self.to(device="cpu") |
| 342 | |
| 343 | def float(self): |
| 344 | """Converts the matrix values to float32 data type. If the matrix |
| 345 | already uses float data type, the original matrix will be returned. |
| 346 | |
| 347 | Returns |
| 348 | ------- |
| 349 | SparseMatrix |
| 350 | The matrix with float values |
| 351 | |
| 352 | Examples |
| 353 | -------- |
| 354 | |
| 355 | >>> indices = torch.tensor([[1, 1, 2], [1, 2, 0]]) |
| 356 | >>> val = torch.ones(len(row)).long() |
| 357 | >>> A = dglsp.spmatrix(indices, val, shape=(3, 4)) |
| 358 | >>> A.float() |
| 359 | SparseMatrix(indices=tensor([[1, 1, 2], |
| 360 | [1, 2, 0]]), |
| 361 | values=tensor([1., 1., 1.]), |
| 362 | shape=(3, 4), nnz=3) |
| 363 | """ |
| 364 | return self.to(dtype=torch.float) |
| 365 | |
| 366 | def double(self): |
| 367 | """Converts the matrix values to double data type. If the matrix already |
no test coverage detected