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

Fix nonzero result dtype win #1336

Merged
merged 3 commits into from
Aug 11, 2023
Merged

Conversation

oleksandr-pavlyk
Copy link
Collaborator

This PR closes gh-1335.

It introduced array API notion of (device-specific) default index data type, and ensure that dpctl.tensor.nonzero
output arrays are created of this data type.

Relevant test was adjusted accordingly.

  • 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?

This returns default index type for give device. Since all devices
are 64-bit devices, it always returns "i8".
Closes gh-1335.

The issue was caused by nonzero using default integral data type,
not default index data type.
@github-actions
Copy link

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 84.923%. remained the same when pulling e70891b on fix-nonzero-result-dtype-win into ed93e02 on master.

@github-actions
Copy link

Array API standard conformance tests for dpctl=0.14.6dev1=py310h7bf5fec_38 ran successfully.
Passed: 912
Failed: 88
Skipped: 119

@oleksandr-pavlyk
Copy link
Collaborator Author

Verified:

(check-gh-1336) C:\Users\opavlyk>
(check-gh-1336) C:\Users\opavlyk>conda list dpctl
# packages in environment at C:\Users\opavlyk\Miniconda3\envs\check-gh-1336:
#
# Name                    Version                   Build  Channel
dpctl                     0.14.6dev1      py310h82a8827_38    file:///c:/Users/opavlyk/dpctl-channel

(check-gh-1336) C:\Users\opavlyk>python -c "import dpctl.tensor as dpt; dpt.nonzero(dpt.ones(3))"

(check-gh-1336) C:\Users\opavlyk>python -c "import dpctl.tensor as dpt; print(dpt.nonzero(dpt.ones(3)))"
(usm_ndarray([0, 1, 2]),)

(check-gh-1336) C:\Users\opavlyk>python -c "import dpctl.tensor as dpt; print(dpt.nonzero(dpt.ones(3))[0].dtype)"
int64

Copy link
Collaborator

@vlad-perevezentsev vlad-perevezentsev left a comment

Choose a reason for hiding this comment

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

LGTM!
thanks @oleksandr-pavlyk

@oleksandr-pavlyk
Copy link
Collaborator Author

The array API test failure "array_api_tests/test_special_cases.py:1240: " is marked as flaky by hypothesis, and responsible for passing tests being one fewer than in the main branch. Ready to merge.

@oleksandr-pavlyk oleksandr-pavlyk merged commit 6f0969c into master Aug 11, 2023
@oleksandr-pavlyk oleksandr-pavlyk deleted the fix-nonzero-result-dtype-win branch August 11, 2023 16:05
@github-actions
Copy link

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

@github-actions
Copy link

Array API standard conformance tests for dpctl=0.14.6dev1=py310h7bf5fec_44 ran successfully.
Passed: 913
Failed: 87
Skipped: 119

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.

dpctl.tensor.nonzero returns an incorrect array dtype in dpctl=0.14.6dev1 [win]
3 participants