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

Method long

python/dgl/sparse/sparse_matrix.py:410–430  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

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
412 uses long data type, the original matrix will be returned.
413
414 Returns
415 -------
416 DiagMatrix
417 The matrix with long values
418
419 Examples
420 --------
421
422 >>> indices = torch.tensor([[1, 1, 2], [1, 2, 0]])
423 >>> A = dglsp.spmatrix(indices, shape=(3, 4))
424 >>> A.long()
425 SparseMatrix(indices=tensor([[1, 1, 2],
426 [1, 2, 0]]),
427 values=tensor([1, 1, 1]),
428 shape=(3, 4), nnz=3)
429 """
430 return self.to(dtype=torch.long)
431
432 def coalesce(self):
433 """Returns a coalesced sparse matrix.

Callers 15

edge_samplerMethod · 0.45
backwardMethod · 0.45
backwardMethod · 0.45
gather_rowFunction · 0.45
scatter_rowFunction · 0.45
scatter_row_inplaceFunction · 0.45
local_state_dictMethod · 0.45
stepMethod · 0.45
_shared_stepMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45

Calls 1

toMethod · 0.95

Tested by

no test coverage detected