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

Function test_blockwise_different_optimization

dask/tests/test_distributed.py:637–656  ·  view source on GitHub ↗
(c)

Source from the content-addressed store, hash-verified

635
636
637def test_blockwise_different_optimization(c):
638 # Regression test for incorrect results due to SubgraphCallable.__eq__
639 # not correctly handling subgraphs with the same outputs and arity but
640 # different internals (GH-7632). The bug is triggered by distributed
641 # because it uses a function cache.
642 np = pytest.importorskip("numpy")
643 da = pytest.importorskip("dask.array")
644
645 u = da.from_array(np.arange(3))
646 v = da.from_array(np.array([10 + 2j, 7 - 3j, 8 + 1j]))
647 cv = v.conj()
648 x = u * cv
649 (cv,) = dask.optimize(cv)
650 y = u * cv
651 expected = np.array([0 + 0j, 7 + 3j, 16 - 2j])
652 with dask.config.set({"optimization.fuse.active": False}):
653 x_value = x.compute()
654 y_value = y.compute()
655 np.testing.assert_equal(x_value, expected)
656 np.testing.assert_equal(y_value, expected)
657
658
659@gen_cluster(client=True)

Callers

nothing calls this directly

Calls 5

setMethod · 0.80
arangeMethod · 0.45
conjMethod · 0.45
optimizeMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…