MCPcopy Create free account
hub / github.com/InternScience/SciReason / process_hdf5_sparse_matrix

Function process_hdf5_sparse_matrix

opencompass/datasets/scicode.py:67–84  ·  view source on GitHub ↗
(group)

Source from the content-addressed store, hash-verified

65
66
67def process_hdf5_sparse_matrix(group):
68 data = group['data'][()]
69 shape = tuple(group['shape'][()])
70 if 'row' in group and 'col' in group:
71 row = group['row'][()]
72 col = group['col'][()]
73 return scipy.sparse.coo_matrix((data, (row, col)), shape=shape)
74 elif 'blocksize' in group:
75 indices = group['indices'][()]
76 indptr = group['indptr'][()]
77 blocksize = tuple(group['blocksize'][()])
78 return scipy.sparse.bsr_matrix((data, indices, indptr),
79 shape=shape,
80 blocksize=blocksize)
81 else:
82 indices = group['indices'][()]
83 indptr = group['indptr'][()]
84 return scipy.sparse.csr_matrix((data, indices, indptr), shape=shape)
85
86
87def process_hdf5_datagroup(group):

Callers 2

process_hdf5_dictFunction · 0.85
process_hdf5_datagroupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected