Add Python scalar support to dpt.where#1719
Merged
ndgrigorian merged 3 commits intomasterfrom Jul 2, 2024
Merged
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. |
Collaborator
antonwolfy
reviewed
Jun 26, 2024
|
Array API standard conformance tests for dpctl=0.18.0dev0=py310h15de555_81 ran successfully. |
Collaborator
antonwolfy
approved these changes
Jun 28, 2024
Collaborator
antonwolfy
left a comment
There was a problem hiding this comment.
I checked the PR in dpnp tests and all tests are passed on GPU and CPU devices.
Collaborator
Author
|
CI failure is unrelated to this PR, I will go ahead and merge it |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR proposes a change to
dpt.whereto add support for Python scalars, aligning it withclipand elementwise functions.As has been pointed out by the array API community, an common use-case for
dpt.whereis supporting Python scalars. If the decision to permit them in other elementwise functions is made,wherewill 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.