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

Removes malformed fast path for zero-size arrays in `repeat` #1682

Closed ndgrigorian closed 1 month ago

ndgrigorian commented 1 month ago

This PR fixes a small bug in dpctl.tensor.repeat caught by the array API tests where calling repeat with axis=None on a zero-size array would result in an array with the shape of the input, rather than x.shape == (0,) as expected.

To fix this, the malformed fast path for zero-size arrays has been removed, as it was unnecessary: all calls in repeat are already special-cased in the C++ backend to return empty events for zero-size inputs, so any savings for this path were minimal.

ndgrigorian commented 1 month ago

@oleksandr-pavlyk I've added a test for the correct behavior.

github-actions[bot] commented 1 month ago

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

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_358 ran successfully. Passed: 890 Failed: 15 Skipped: 91

coveralls commented 1 month ago

Coverage Status

coverage: 87.967% (+0.02%) from 87.951% when pulling 4c64cf442e92bed9c8671b31d669121d1c6f75e2 on fix-repeat-size-zero-arrays into c994666251c564f544c976be1dba72033941d543 on master.

github-actions[bot] commented 1 month ago

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_359 ran successfully. Passed: 889 Failed: 16 Skipped: 91