Skip to content
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

Allow dtype to be passed to blockwise and reduction functions #321

Merged
merged 4 commits into from
Nov 16, 2023

Conversation

tomwhite
Copy link
Member

This fixes a bug where the dtype of the output array in the reduction is not correct. The problem is caused by the fact that extra kwargs to the blockwise function cannot include dtype since blockwise itself has a dtype arg. This is solved by adding extra_func_kwargs that can be used to set dtype on the blockwise function.

This was discovered in #187 (comment), since TensorStore is stricter than Zarr about casting when setting a values in an array. (For example, TensorStore fails with Cannot cast array data from dtype('float64') to dtype('float32') according to the rule 'safe', whereas Zarr will silently cast to float32.)

@tomwhite tomwhite force-pushed the reduction-dtype-fix branch from 2556d1c to d28db0a Compare November 15, 2023 10:33
@tomwhite tomwhite force-pushed the reduction-dtype-fix branch from d28db0a to 84425e7 Compare November 16, 2023 14:53
@tomwhite tomwhite merged commit d19caec into main Nov 16, 2023
7 checks passed
@tomwhite tomwhite deleted the reduction-dtype-fix branch November 16, 2023 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant