-
Notifications
You must be signed in to change notification settings - Fork 32
Adds element-wise functions angle and reciprocal
#1474
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
Conversation
This change was made to mirror promotion behavior of divide in reciprocal Adds getter method for the acceptance function Adds tests for reciprocal
_zero_like did not have logic accounting for 0D arrays, so `x.imag` failed for 0D x
This prevents unexpected behavior when calling `imag` i.e., for x with a real-valued data type `dpctl.tensor.atan2(x.imag, x.real)` would not work prior to this change
The logic in these properties did not work for float16 data types, returning None instead of `self` or an array of zeros
|
View rendered docs @ https://intelpython.github.io/dpctl/pulls/1474/index.html |
|
Array API standard conformance tests for dpctl=0.15.1dev2=py310h15de555_26 ran successfully. |
|
Array API standard conformance tests for dpctl=0.15.1dev2=py310h15de555_27 ran successfully. |
|
Array API standard conformance tests for dpctl=0.15.1dev2=py310h15de555_27 ran successfully. |
| """ | ||
| if (self.typenum_ < UAR_CFLOAT): | ||
| # explicitly check for UAR_HALF, which is greater than UAR_CFLOAT | ||
| if (self.typenum_ < UAR_CFLOAT or self.typenum_ == UAR_HALF): |
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.
Good catch!
oleksandr-pavlyk
left a comment
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.
Module the renaming suggestion this PR is in perfect shape. The renaming can be addressed in a separate PR though.
`_acceptance_fn_default1` and `_acceptance_fn_default2` are now `_acceptance_fn_default_unary` and `_acceptance_fn_default_binary`
I noticed a typo in the |
|
Array API standard conformance tests for dpctl=0.15.1dev2=py310h15de555_29 ran successfully. |
|
Internal CI failures are not related to this PR and will be investigated separately I will merge this |
This pull request implements two new element-wise functions,
dpctl.tensor.angleanddpctl.tensor.reciprocal.To support the inclusion of
reciprocal, an acceptance function argument to theUnaryElementwiseFuncclass is added to align the behavior ofreciprocalanddivide.This pull request also slips in bug fixes to
usm_ndarray-- namely, therealandimagproperties.imagwas not allocating to the same queue as the original array for real-valued types, and would raise an exception for real-valued 0D arrays.Both
realandimagwould returnNoneforfloat16arrays as a result of incorrect logic in the typenum checks.