use nested_duck_arrays
to detect the innermost layer of duck arrays
#9212
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
as_shared_dtype
converts scalars to 0dnumpy
arrays if chunkedcupy
is involved #7721whats-new.rst
As described in #7721 (comment), this uses
nested_duck_arrays.first_layer
(or should that be calledinnermost_layer
? Not sure) to detectcupy
under one or more layers of duck arrays.This is highly experimental, and before merging this, I'd like to:
nested_duck_arrays
– the name of the protocol, and the names of the functions innested_duck_arrays
are not set, yet.pint
anddask
(the most common duck arrays that create layers) to implement the protocolnested_duck_arrays
to PyPI andconda-forge
Also, the tests make use of
cupy
(which we don't install in CI), which means we can't really check that this works... but at least we can verify that the changes here don't affect anything else.