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

Function test_blockwise_different_optimization

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

Source from the content-addressed store, hash-verified

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