You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make one of the devices have a lower maximum float precision #64
As a follow up to #56: it would be useful to make one of the "devices" have a lower maximum float precision than the rest. To mirror what, for example, PyTorch's MPS device does (this is the "Apple silicon" GPU in modern MacBooks).
I think having a "lower maximum precision" device would be the last piece we'd need in scikit-learn to be able to find all "user errors" when writing array API code. This way people writing array API code don't need to have a GPU available to find and debug the errors you get when using a device that isn't a CPU.
My thinking is that the default set of devices should cover the important use-cases (including this), but you should also be able to manually set what devices are active using the flags API.
In [11]: t = torch.as_tensor([1, 2, 3.0], device='mps')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[11], line 1
----> 1 t = torch.as_tensor([1, 2, 3.0], device='mps')
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.
So strictly speaking, these "metal" backends are not compliant. This is similar to JAX, which is compliant in the X64 mode only.
Given that array-api-strict is scrupulous in following the spec to the detail, and given that there clearly is interest in supporting these fancy "metal" frameworks (cf a recent scipy mention), maybe this is something to consider for the spec itself? array-api-strict will then happily follow.
Activity
asmeurer commentedon Oct 3, 2024
My thinking is that the default set of devices should cover the important use-cases (including this), but you should also be able to manually set what devices are active using the flags API.
asmeurer commentedon Oct 3, 2024
This is related to #38
ev-br commentedon Dec 12, 2025
Given that it's been a year (sigh), is it something scikit-learn feels as sorely missing @betatim ?
betatim commentedon Jan 5, 2026
It hasn't come up again as far as I remember. Using that as a yard stick: not super urgent/important.
But I think in general this would be useful to have. Maybe the next step is to decide on what we want to implement to make this happen?
ev-br commentedon Jan 5, 2026
The very first question I suppose is this:
and the spec requires
float64: A conforming implementation of the array API standard must provide and support the following data types ... float64.So strictly speaking, these "metal" backends are not compliant. This is similar to JAX, which is compliant in the X64 mode only.
Given that
array-api-strictis scrupulous in following the spec to the detail, and given that there clearly is interest in supporting these fancy "metal" frameworks (cf a recent scipy mention), maybe this is something to consider for the spec itself? array-api-strict will then happily follow.ev-br commentedon Apr 24, 2026
Prompted by #70 (comment), here's a WIP PR to implement a float32-only device: #206
betatim commentedon Apr 27, 2026
(I just noticed and had to laugh: issue #64 is about less than float64 precision. Monday morning brain is easily entertained 😆 )