MCPcopy
hub / github.com/tkipf/gcn / to_tuple

Function to_tuple

gcn/utils.py:95–101  ·  view source on GitHub ↗
(mx)

Source from the content-addressed store, hash-verified

93def sparse_to_tuple(sparse_mx):
94 """Convert sparse matrix to tuple representation."""
95 def to_tuple(mx):
96 if not sp.isspmatrix_coo(mx):
97 mx = mx.tocoo()
98 coords = np.vstack((mx.row, mx.col)).transpose()
99 values = mx.data
100 shape = mx.shape
101 return coords, values, shape
102
103 if isinstance(sparse_mx, list):
104 for i in range(len(sparse_mx)):

Callers 1

sparse_to_tupleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected