()
| 49 | |
| 50 | @pytest.mark.array_expr |
| 51 | def test_blockwise(): |
| 52 | x = da.random.random((10, 10), chunks=(5, 5)) |
| 53 | z = da.blockwise(operator.add, "ij", x, "ij", 100, None, dtype=x.dtype) |
| 54 | assert_eq(z, x.compute() + 100) |
| 55 | |
| 56 | x = da.random.random((10, 10), chunks=(5, 5)) |
| 57 | z = da.blockwise(operator.add, "ij", x, "ij", x, "ij", dtype=x.dtype) |
| 58 | expr = z.expr.optimize() |
| 59 | assert len(list(expr.find_operations(Rechunk))) == 0 |
| 60 | assert_eq(z, x.compute() * 2) |
| 61 | |
| 62 | # align |
| 63 | x = da.random.random((10, 10), chunks=(5, 5)) |
| 64 | y = da.random.random((10, 10), chunks=(7, 3)) |
| 65 | z = da.blockwise(operator.add, "ij", x, "ij", y, "ij", dtype=x.dtype) |
| 66 | expr = z.expr.optimize() |
| 67 | assert len(list(expr.find_operations(Rechunk))) > 0 |
| 68 | assert_eq(z, x.compute() + y.compute()) |
| 69 | |
| 70 | |
| 71 | @pytest.mark.parametrize("func", ["min", "max", "sum", "prod", "mean", "any", "all"]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…