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

Method coo

python/dgl/sparse/sparse_matrix.py:94–116  ·  view source on GitHub ↗

r"""Returns the coordinate list (COO) representation of the sparse matrix. See `COO in Wikipedia `_. Returns ------- torch.Tensor Row coordinate torch.Tensor

(self)

Source from the content-addressed store, hash-verified

92 return self.coo()[1]
93
94 def coo(self) -> Tuple[torch.Tensor, torch.Tensor]:
95 r"""Returns the coordinate list (COO) representation of the sparse
96 matrix.
97
98 See `COO in Wikipedia <https://en.wikipedia.org/wiki/
99 Sparse_matrix#Coordinate_list_(COO)>`_.
100
101 Returns
102 -------
103 torch.Tensor
104 Row coordinate
105 torch.Tensor
106 Column coordinate
107
108 Examples
109 --------
110
111 >>> indices = torch.tensor([[1, 2, 1], [2, 4, 3]])
112 >>> A = dglsp.spmatrix(indices)
113 >>> A.coo()
114 (tensor([1, 2, 1]), tensor([2, 4, 3]))
115 """
116 return self.c_sparse_matrix.coo()
117
118 def indices(self) -> torch.Tensor:
119 r"""Returns the coordinate list (COO) representation in one tensor with

Callers 15

rowMethod · 0.95
colMethod · 0.95
to_denseMethod · 0.95
toMethod · 0.95
_sparse_matrix_strFunction · 0.80
test_negFunction · 0.80
dense_maskFunction · 0.80
all_close_sparseFunction · 0.80
test_powFunction · 0.80
test_from_cooFunction · 0.80
test_csr_to_cooFunction · 0.80

Calls

no outgoing calls

Tested by 13

test_negFunction · 0.64
all_close_sparseFunction · 0.64
test_powFunction · 0.64
test_from_cooFunction · 0.64
test_csr_to_cooFunction · 0.64
test_csc_to_cooFunction · 0.64
test_diag_conversionsFunction · 0.64
check_val_likeFunction · 0.64
test_diagFunction · 0.64
test_sddmmFunction · 0.64
test_bsddmmFunction · 0.64