()
| 376 | |
| 377 | @pytest.mark.xfail(da._array_expr_enabled(), reason="reshape needed") # type: ignore |
| 378 | def test_map_overlap_multiarray(): |
| 379 | # Same ndim, same numblocks, same chunks |
| 380 | x = da.arange(10, chunks=5) |
| 381 | y = da.arange(10, chunks=5) |
| 382 | z = da.map_overlap(lambda x, y: x + y, x, y, depth=1, boundary="none") |
| 383 | assert_eq(z, 2 * np.arange(10)) |
| 384 | |
| 385 | # Same ndim, same numblocks, different chunks |
| 386 | x = da.arange(10, chunks=(2, 3, 5)) |
| 387 | y = da.arange(10, chunks=(5, 3, 2)) |
| 388 | z = da.map_overlap(lambda x, y: x + y, x, y, depth=1, boundary="none") |
| 389 | assert z.chunks == ((2, 3, 3, 2),) |
| 390 | assert_eq(z, 2 * np.arange(10)) |
| 391 | |
| 392 | # Same ndim, different numblocks, different chunks |
| 393 | x = da.arange(10, chunks=(10,)) |
| 394 | y = da.arange(10, chunks=(4, 4, 2)) |
| 395 | z = da.map_overlap(lambda x, y: x + y, x, y, depth=1, boundary="none") |
| 396 | assert z.chunks == ((4, 4, 2),) |
| 397 | assert_eq(z, 2 * np.arange(10)) |
| 398 | |
| 399 | # Different ndim, different numblocks, different chunks |
| 400 | x = da.arange(10, chunks=(10,)) |
| 401 | y = da.arange(10).reshape(1, 10).rechunk((1, (4, 4, 2))) |
| 402 | z = da.map_overlap(lambda x, y: x + y, x, y, depth=1, boundary="none") |
| 403 | assert z.chunks == ((1,), (4, 4, 2)) |
| 404 | assert z.shape == (1, 10) |
| 405 | assert_eq(z, 2 * np.arange(10)[np.newaxis]) |
| 406 | |
| 407 | # Note: checks on arange equality in all of the above help ensure that |
| 408 | # trimming is applied appropriately to result chunks (i.e. results |
| 409 | # are not somehow shifted) |
| 410 | |
| 411 | |
| 412 | def test_map_overlap_multiarray_defaults(): |
nothing calls this directly
no test coverage detected