-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add Python scalar support to dpt.where
#1719
Conversation
`x1` and `x2` can now both be Python scalars. As `condition` has no impact on the data type of the result, when both are scalars, the default data type for the scalar kind is used.
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
Array API standard conformance tests for dpctl=0.18.0dev0=py310h15de555_80 ran successfully. |
Array API standard conformance tests for dpctl=0.18.0dev0=py310h15de555_81 ran successfully. |
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.
I checked the PR in dpnp tests and all tests are passed on GPU and CPU devices.
CI failure is unrelated to this PR, I will go ahead and merge it |
This PR proposes a change to
dpt.where
to add support for Python scalars, aligning it withclip
and elementwise functions.As has been pointed out by the array API community, an common use-case for
dpt.where
is supporting Python scalars. If the decision to permit them in other elementwise functions is made,where
will likely follow suit.Regardless of the outcome of this decision, it's sensible to support them here.
As the first argument (
condition
) does not participate in the type promotion inwhere
, if both arguments are scalars, the scalars are treated as the default types for the respective kind.