Skip to content
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

BUG: Allow integer inputs for pow-related functions in array_api #20807

Merged
merged 1 commit into from Jan 13, 2022

Conversation

charris
Copy link
Member

@charris charris commented Jan 12, 2022

Backport of 20762.

Updates xp.pow(), x.__pow__(), x.__ipow()__ and x.__rpow()__ to accept integer inputs. Partially resolves #20752. @asmeurer initially wrote these when the Array API spec said only float inputs were allowed, but it has since changed to accept all numeric dtypes.

This PR notably only enables integer arrays to work with integer arrays, and not allow the mix of integer arrays with floating arrays, which is out-of-scope for the Array API (i.e. mixing non-promotable dtypes together). This is to keep with the numpy.array_api philosophy of not implementing beyond the spec... and conveniently already covered nicely by the internal use of result_type().

This is smoke tested via the xptests/test_operators_and_elementwise_functions.py::test_pow test case(s) in array-api-tests. Better testing would be ideal, but these pow-related functions are using NumPy proper's pow-related functions anywho.

Updates `xp.power()`, `x.__pow__()`, `x.__ipow()__` and `x.__rpow()__`
@charris charris added this to the 1.22.1 release milestone Jan 12, 2022
@charris charris merged commit f90c972 into numpy:maintenance/1.22.x Jan 13, 2022
@charris charris deleted the backport-20762 branch January 13, 2022 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants