MCPcopy Create free account
hub / github.com/dask/dask / test_blockwise_different_optimization

Function test_blockwise_different_optimization

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

Source from the content-addressed store, hash-verified

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