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

Implements dpctl.tensor.count_nonzero and dpctl.tensor.diff #1732

Merged
merged 25 commits into from
Aug 2, 2024

Conversation

ndgrigorian
Copy link
Collaborator

This PR proposes introducing two new functions to dpctl which will be coming to the array API specification's next version: count_nonzero and diff.

  • count_nonzero casts an array to bool before calling sum. As dedicated kernels for sum of bool into any integer type, the summation won't require any additional copies.

  • diff recursively takes the n-th forward difference along a given axis of an array. prepend and append arguments (which can be arrays or scalars) are concatenated to the input array. We diverge from the array API by permitting scalars for prepend and append as well as not constraining them to the same type as the input array

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • If this PR is a work in progress, are you opening the PR as a draft?

Copy link

github-actions bot commented Jul 13, 2024

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

@coveralls
Copy link
Collaborator

coveralls commented Jul 13, 2024

Coverage Status

coverage: 87.736% (+0.1%) from 87.614%
when pulling 6520cc0 on diff-count-nonzero-array-api
into c7af3a0 on master.

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310h15de555_106 ran successfully.
Passed: 894
Failed: 15
Skipped: 105

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_180 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_192 ran successfully.
Passed: 895
Failed: 0
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_194 ran successfully.
Passed: 895
Failed: 0
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_195 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_196 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_200 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_207 ran successfully.
Passed: 895
Failed: 0
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_208 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_207 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

@ndgrigorian ndgrigorian marked this pull request as ready for review July 31, 2024 15:05
Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_211 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_220 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_221 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

Copy link

github-actions bot commented Aug 1, 2024

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_226 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

Copy link

github-actions bot commented Aug 1, 2024

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_227 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

@oleksandr-pavlyk
Copy link
Collaborator

Please add tensor.diff and tensor.count_nonzero to docs.

@ndgrigorian
Copy link
Collaborator Author

Please add tensor.diff and tensor.count_nonzero to docs.

I will add nextafter too, since it was forgotten

Copy link

github-actions bot commented Aug 1, 2024

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_228 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

@oleksandr-pavlyk
Copy link
Collaborator

On the diff page, can the bullet be changed into an indent?

image

Copy link

github-actions bot commented Aug 2, 2024

Array API standard conformance tests for dpctl=0.18.0dev0=py310ha798474_229 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

Copy link
Collaborator

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ndgrigorian ! Ready to be merged

@ndgrigorian ndgrigorian merged commit 1ecd8a8 into master Aug 2, 2024
40 of 41 checks passed
@ndgrigorian ndgrigorian deleted the diff-count-nonzero-array-api branch August 2, 2024 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants