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

Function chunk_numpy_array

tools/chunk_graph.py:15–27  ·  view source on GitHub ↗
(arr, fmt_meta, chunk_sizes, path_fmt)

Source from the content-addressed store, hash-verified

13
14
15def chunk_numpy_array(arr, fmt_meta, chunk_sizes, path_fmt):
16 paths = []
17 offset = 0
18
19 for j, n in enumerate(chunk_sizes):
20 path = os.path.abspath(path_fmt % j)
21 arr_chunk = arr[offset : offset + n]
22 logging.info("Chunking %d-%d" % (offset, offset + n))
23 array_readwriter.get_array_parser(**fmt_meta).write(path, arr_chunk)
24 offset += n
25 paths.append(path)
26
27 return paths
28
29
30def _chunk_graph(

Callers 1

_chunk_graphFunction · 0.85

Calls 3

infoMethod · 0.80
appendMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected