MCPcopy
hub / github.com/dask/dask / test_chunk_structure_independence

Function test_chunk_structure_independence

dask/array/tests/test_reductions.py:934–950  ·  view source on GitHub ↗
(axes, split_every, chunks)

Source from the content-addressed store, hash-verified

932 "axes", list(permutations((0, 1, 2), 2)) + list(permutations((0, 1, 2)))
933)
934def test_chunk_structure_independence(axes, split_every, chunks):
935 # Reducing an array should not depend on its chunk-structure!!!
936 # See Issue #8541: https://github.com/dask/dask/issues/8541
937 shape = tuple(np.sum(s) for s in chunks)
938 np_array = np.arange(np.prod(shape)).reshape(*shape)
939 x = da.from_array(np_array, chunks=chunks)
940 reduced_x = da.reduction(
941 x,
942 lambda x, axis, keepdims: x,
943 lambda x, axis, keepdims: x,
944 keepdims=True,
945 axis=axes,
946 split_every=split_every,
947 dtype=x.dtype,
948 meta=x._meta,
949 )
950 assert_eq(reduced_x, np_array, check_chunks=False, check_shape=False)
951
952
953def test_weighted_reduction():

Callers

nothing calls this directly

Calls 6

assert_eqFunction · 0.90
reshapeMethod · 0.80
sumMethod · 0.45
arangeMethod · 0.45
prodMethod · 0.45
reductionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…