-
Notifications
You must be signed in to change notification settings - Fork 23
Implement dpnp.erf
through pybind11 extension
#2551
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
Array API standard conformance tests for dpnp=0.19.0dev3=py313h509198e_68 ran successfully. |
View rendered docs @ https://intelpython.github.io/dpnp/index.html |
c261a83
to
410dcb5
Compare
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 @antonwolfy for the implementation of dpnp.erf and significant cleanup of cython code!!!
a801c13
to
78640ba
Compare
… result, mismatching scipy
…th, and cron tests run Applly pre-commit rule in toml file
Applly pre-commit rule in toml file
…to pass dpnp with scipy>=1.16
Add a comment to casting in ErfFunctor implementation
cd3c5d5
to
2de4f06
Compare
@ndgrigorian, let me know if you have more comments |
namespace dpnp::kernels::erf | ||
{ | ||
template <typename argT, typename Tp> | ||
struct ErfFunctor |
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.
to this day, I'm not sure why we didn't use inheritance with these structs from a common parent with sensible defaults. That may be the smart thing to do someday. For sure not in this PR though. Leaving this comment to remember.
result = dpnp.special.erf(ia) | ||
expected = scipy.special.erf(a) |
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.
it might be more readable and reliable to simply test against the expected values, i.e, that erf(nan)
gives nan
, erf(inf)
gives 1, and erf(-inf)
gives -1
this way bugs or changes in behavior in scipy don't impact this test
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.
also wouldn't mind tests for 0 and -0
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.
It's the current dpnp approach to test against numpy or scipy to ensure alignment in the behavior.
Btw, I've added a dedicated test for signed zero.
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.
other than minor comments about the test this LGTM
The PR changes the implementation of
dpnp.erf
function. It now invokesoneapi::mkl::vm
implementation from pybind11 extension of OneMKL VM if possible or uses dedicated kernel from pybind11 extension ofufunc
.