def test_chunk_structure_independence(axes, split_every, chunks): # Reducing an array should not depend on its chunk-structure!!! # See Issue #8541: https://github.com/dask/dask/issues/8541 shape = tuple(np.sum(s) for s in chunks) np_array = np.arange(np.prod(shape)).reshape(*shape) x = da.from_array(np_array, chunks=chunks) reduced_x = da.reduction( x, lambda x, axis, keepdims: x, lambda x, axis, keepdims: x, keepdims=True, axis=axes, split_every=split_every, dtype=x.dtype, meta=x._meta, ) _assert_eq(reduced_x, np_array, check_chunks=False, check_shape=False)
def assert_eq(a, b): _assert_eq(a, b, equal_nan=True)
def assert_eq(a, b): _assert_eq(a, b, equal_nan=True)