-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fixes to apply_parallel for functions working with multichannel data #4927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
One subtlety: specifying The following example demonstrates via direct use of map_blocks that the output dtype is determined via a combination of the input data-type and the import numpy as np
import dask.array as da
for dtype_in, dtype_map_blocks in [
(np.uint8, np.float32),
(np.uint16, np.float32),
(np.uint32, np.float32),
(np.float32, np.float16),
(np.float32, np.float32),
(np.float32, np.float64),
(np.float64, np.float16),
(np.float64, np.float32),
(np.float64, np.float64)
]:
x = da.from_array(np.arange(64, dtype=dtype_in))
out = da.map_blocks(np.sqrt, x, chunks=(8,), dtype=dtype_map_blocks).compute()
print(f"dtype_in={np.dtype(dtype_in).name}, "
f"dtype_map_blocks={np.dtype(dtype_map_blocks).name} -> "
f"dtype_out={out.dtype.name}")
|
Should the docstring be modified to suggest that this parameter is here to help dask, but is by no means a guarantee of the output dtype? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you @grlee77 ! |
Description
closes #4900
The
multichannel
argument helps give sensible default chunks and expands scalardepth
arguments appropriately for multichannel data.A concrete example where the
dtype
argument is needed for this to pass was added as a test case. There is an explanation of the reason it is needed in #4900 (comment).Checklist
./doc/examples
(new features only)./benchmarks
, if your changes aren't covered by anexisting benchmark
For reviewers
later.
__init__.py
.doc/release/release_dev.rst
.