IntelPython / dpctl

Python SYCL bindings and SYCL-based Python Array API library
https://intelpython.github.io/dpctl/
Apache License 2.0
97 stars 29 forks source link

Add Python scalar support to `dpt.where` #1719

Closed ndgrigorian closed 23 hours ago

ndgrigorian commented 6 days ago

This PR proposes a change to dpt.where to add support for Python scalars, aligning it with clip 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 in where, if both arguments are scalars, the scalars are treated as the default types for the respective kind.

github-actions[bot] commented 6 days ago

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. :crossed_fingers:

github-actions[bot] commented 6 days ago

Array API standard conformance tests for dpctl=0.18.0dev0=py310h15de555_80 ran successfully. Passed: 894 Failed: 15 Skipped: 105

coveralls commented 6 days ago

Coverage Status

coverage: 87.965% (-0.09%) from 88.057% when pulling 20929bec233d2525701234f2e9610ac36a44a161 on support-scalars-in-where into 26d34f565d36572b3207cd1e969312eae4eabacc on master.

github-actions[bot] commented 6 days ago

Array API standard conformance tests for dpctl=0.18.0dev0=py310h15de555_81 ran successfully. Passed: 894 Failed: 15 Skipped: 105

coveralls commented 6 days ago

Coverage Status

coverage: 87.965% (-0.09%) from 88.057% when pulling 9f449d1f1f03ae0a447f2575b1626821716717b9 on support-scalars-in-where into 26d34f565d36572b3207cd1e969312eae4eabacc on master.

ndgrigorian commented 23 hours ago

CI failure is unrelated to this PR, I will go ahead and merge it