MCPcopy Index your code
hub / github.com/dmlc/dgl / int

Method int

python/dgl/sparse/sparse_matrix.py:388–408  ·  view source on GitHub ↗

Converts the matrix values to int32 data type. If the matrix already uses int data type, the original matrix will be returned. Returns ------- DiagMatrix The matrix with int values Examples -------- >>> indices = torch.tensor([[1

(self)

Source from the content-addressed store, hash-verified

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
390 uses int data type, the original matrix will be returned.
391
392 Returns
393 -------
394 DiagMatrix
395 The matrix with int values
396
397 Examples
398 --------
399
400 >>> indices = torch.tensor([[1, 1, 2], [1, 2, 0]])
401 >>> A = dglsp.spmatrix(indices, shape=(3, 4))
402 >>> A.int()
403 SparseMatrix(indices=tensor([[1, 1, 2],
404 [1, 2, 0]]),
405 values=tensor([1, 1, 1], dtype=torch.int32),
406 shape=(3, 4), nnz=3)
407 """
408 return self.to(dtype=torch.int)
409
410 def long(self):
411 """Converts the matrix values to long data type. If the matrix already

Callers 3

libra_partitionFunction · 0.45
forwardMethod · 0.45

Calls 1

toMethod · 0.95

Tested by

no test coverage detected