-
Notifications
You must be signed in to change notification settings - Fork 50
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
fix: clarify that condition
should have a boolean dtype in where
#868
Conversation
Would be nice to add to the agenda of the consortium meeting on Thursday. From the spec I cannot figure out if it is meant to be truly boolean or just truth/falsy (and if so, torch is not conformant) |
And indeed this used to be in the standard, until it was (seemingly accidentally) lost with gh-116, as mentioned above. |
That indeed seems to be completely accidental. I marked this for the 2024 milestone and backporting, will merge soon unless there are more comments, since it looks uncontroversial and caused by a minor editing hiccup only. |
Since this should be backported, I believe we can go ahead and do that in this PR. |
where
: clarify that condition
should have a boolean dtypecondition
should have a boolean dtype in where
Co-authored-by: Athan <[email protected]>
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.
LGTM! Thanks, @lucascolley!
As the language uses |
data-apis/array-api-strict#106 implements this in xp-strict |
I don't care for the churn, but one day it may be nice spell things always clearly from either implementation or user perspective. The user must pass a boolean (and the implemntation must support it). For the implementation you could suggest that it should reject non-bools if you are opinionated. |
Towards data-apis/array-api-extra#49, scipy/scipy#21783
gh-116 removed this detail because it was contained in a type annotation. Unfortunately, that detail hasn't made its way back into the spec yet, which is causing trouble downstream, with array-api-strict supporting non-boolean input, but
torch
from array-api-compat only supporting boolean input.cc @ev-br @asmeurer