feat: allow subsets of dtypes, allow device-dependent dtype support#1005
feat: allow subsets of dtypes, allow device-dependent dtype support#1005ev-br wants to merge 2 commits intodata-apis:mainfrom
Conversation
rgommers
left a comment
There was a problem hiding this comment.
Thanks @ev-br! One comment on a complex dtype not needing to be required, other than that this LGTM.
I considered whether to require specific types that are currently universally available (e.g., float32, int32), but that doesn't really help in any way while it does potentially create another issue if support shifts over time. So "one integer and one float dtype" seems just fine. In practice, libraries are going to just use them anyway and they will exist; actual code will rely on how to get things working with real-world libraries, not probing the must/should distinctions in the spec (that's mostly relevant for the test suite and authors of new array libraries).
| +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
|
|
||
| If a library only supports a subset of data types, it must support at least one data type | ||
| from each :ref:`category <data-type-categories>`. |
There was a problem hiding this comment.
I don't think complex should be added here, rather bool and one integer and one real floating-point dtype must be supported.
There was a problem hiding this comment.
That would be enough for scikit-learn at least.
Per discussion in gh-998 and the community meeting on Apr 30th,
dtype=..., device=...raise an exception + specify that creation functions should raise. Note that this still leavesastypeandto_deviceonly implicitly specified and only covered by the recommendation to raise.__getitem__and__setitem__are implementation-defined (and presumably covered by the recommendation to raise).