-
Notifications
You must be signed in to change notification settings - Fork 30
Implements sign and remainder #1308
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
- Sign now uses appropriate templates from elementwise_common namespace - Sign standardizes returned NaN value - Added an annotation to `test_sign_negative` clarifying that it is testing for all signed, real data types
55327b0
to
3786efe
Compare
View rendered docs @ https://intelpython.github.io/dpctl/pulls/1308/index.html |
Array API standard conformance tests for dpctl= ran successfully. |
Array API standard conformance tests for dpctl= ran successfully. |
dpctl/tensor/libtensor/include/kernels/elementwise_functions/sign.hpp
Outdated
Show resolved
Hide resolved
dpctl/tensor/libtensor/include/kernels/elementwise_functions/sign.hpp
Outdated
Show resolved
Hide resolved
dpctl/tensor/libtensor/include/kernels/elementwise_functions/sign.hpp
Outdated
Show resolved
Hide resolved
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_52 ran successfully. |
dpctl/tensor/libtensor/include/kernels/elementwise_functions/remainder.hpp
Outdated
Show resolved
Hide resolved
dpctl/tensor/libtensor/include/kernels/elementwise_functions/remainder.hpp
Outdated
Show resolved
Hide resolved
dpctl/tensor/libtensor/include/kernels/elementwise_functions/remainder.hpp
Outdated
Show resolved
Hide resolved
dpctl/tensor/libtensor/include/kernels/elementwise_functions/remainder.hpp
Outdated
Show resolved
Hide resolved
- Added a test for this behavior for signed and unsigned integers - Implemented l_xor private method to improve remainder readability
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_53 ran successfully. |
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.
LGTM! Thank you @ndgrigorian
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_52 ran successfully. |
Implementation of
dpctl.tensor.sign
anddpctl.tensor.remainder
per array API.Remainder is implemented to emulate the behavior of Python's modulo operator (rather than C's).
Notably,
sign
(intentionally) breaks with Numpy for complex arrays by being equivalent toz /|z|
rather thanz/sqrt(z*z)
as required by the array API specification.