MCPcopy
hub / github.com/dmlc/dgl / double

Method double

python/dgl/sparse/sparse_matrix.py:366–386  ·  view source on GitHub ↗

Converts the matrix values to double data type. If the matrix already uses double data type, the original matrix will be returned. Returns ------- SparseMatrix The matrix with double values Examples -------- >>> indices = torch.t

(self)

Source from the content-addressed store, hash-verified

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
368 uses double data type, the original matrix will be returned.
369
370 Returns
371 -------
372 SparseMatrix
373 The matrix with double values
374
375 Examples
376 --------
377
378 >>> indices = torch.tensor([[1, 1, 2], [1, 2, 0]])
379 >>> A = dglsp.spmatrix(indices, shape=(3, 4))
380 >>> A.double()
381 SparseMatrix(indices=tensor([[1, 1, 2],
382 [1, 2, 0]]),
383 values=tensor([1., 1., 1.], dtype=torch.float64),
384 shape=(3, 4), nnz=3)
385 """
386 return self.to(dtype=torch.double)
387
388 def int(self):
389 """Converts the matrix values to int32 data type. If the matrix already

Callers 1

to_doubleFunction · 0.45

Calls 1

toMethod · 0.95

Tested by

no test coverage detected