MCPcopy
hub / github.com/dask/dask / concatenate_array_chunks

Function concatenate_array_chunks

dask/array/slicing.py:1428–1461  ·  view source on GitHub ↗

Concatenate the multidimensional chunks of an array. Can be used on chunks with unknown sizes. Parameters ---------- x : dask array Returns ------- dask array The concatenated dask array with one chunk.

(x)

Source from the content-addressed store, hash-verified

1426
1427
1428def concatenate_array_chunks(x):
1429 """Concatenate the multidimensional chunks of an array.
1430
1431 Can be used on chunks with unknown sizes.
1432
1433 Parameters
1434 ----------
1435 x : dask array
1436
1437 Returns
1438 -------
1439 dask array
1440 The concatenated dask array with one chunk.
1441
1442 """
1443 from dask.array.core import Array, concatenate_shaped
1444
1445 if x.npartitions == 1:
1446 return x
1447
1448 name = "concatenate-shaped-" + tokenize(x)
1449 d = {
1450 (name, 0): (
1451 concatenate_shaped,
1452 list(core.flatten(x.__dask_keys__())),
1453 x.numblocks,
1454 )
1455 }
1456 graph = HighLevelGraph.from_collections(name, d, dependencies=[x])
1457 chunks = x.shape
1458 if not chunks:
1459 chunks = (1,)
1460
1461 return Array(graph, name, chunks=(chunks,), dtype=x.dtype)
1462
1463
1464def setitem_array(out_name, array, indices, value):

Callers 3

setitem_arrayFunction · 0.85

Calls 5

ArrayClass · 0.90
flattenMethod · 0.80
from_collectionsMethod · 0.80
tokenizeFunction · 0.50
__dask_keys__Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…