Skip to content

Fix nonzero result dtype win - #1336

Merged
oleksandr-pavlyk merged 3 commits into
masterfrom
fix-nonzero-result-dtype-win
Aug 11, 2023
Merged

oleksandr-pavlyk merged 3 commits into
masterfrom
fix-nonzero-result-dtype-win

Conversation

@oleksandr-pavlyk

Copy link
Copy Markdown
Contributor

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
Copy Markdown

@coveralls

Copy link
Copy Markdown
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
Copy Markdown

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

@oleksandr-pavlyk

Copy link
Copy Markdown
Contributor 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

@vlad-perevezentsev vlad-perevezentsev left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Contributor 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
Copy Markdown

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

@github-actions

Copy link
Copy Markdown

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