MCPcopy Index your code
hub / github.com/dask/dask / test_array_creation_blockwise_fusion

Function test_array_creation_blockwise_fusion

dask/array/tests/test_optimization.py:184–197  ·  view source on GitHub ↗

Check that certain array creation routines work with blockwise and can be fused with other blockwise operations.

()

Source from the content-addressed store, hash-verified

182
183
184def test_array_creation_blockwise_fusion():
185 """
186 Check that certain array creation routines work with blockwise and can be
187 fused with other blockwise operations.
188 """
189 x = da.ones(3, chunks=(3,))
190 y = da.zeros(3, chunks=(3,))
191 z = da.full(3, fill_value=2, chunks=(3,))
192 a = x + y + z
193 dsk1 = a.__dask_graph__()
194 assert len(dsk1) == 5
195 dsk2 = optimize_blockwise(dsk1)
196 assert len(dsk2) == 1
197 assert_eq(a, np.full(3, 3.0))
198
199
200def test_gh3937():

Callers

nothing calls this directly

Calls 6

assert_eqFunction · 0.90
optimize_blockwiseFunction · 0.85
onesMethod · 0.45
zerosMethod · 0.45
fullMethod · 0.45
__dask_graph__Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…