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 array API test failure caused by issue reported in gh-1512 #1513

Merged
merged 1 commit into from
Jan 27, 2024

Conversation

ndgrigorian
Copy link
Collaborator

@ndgrigorian ndgrigorian commented Jan 26, 2024

This pull request adjusts dpt.asarray such that the dtype argument is passed to np.asarray call when called with a Python scalar as input

This guarantees the expected OverflowError is thrown.

Additionally, this PR adds tests for this behavior, for copy=False errors to test_tensor_asarray, and removes a superfluous NotImplementedError for Python sequences from asarray.

Closes gh-1512

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

dtype is passed to np.asarray when dpt.asarray is called with a Python scalar as input

This guarantees the expected OverflowError is thrown
Copy link

github-actions bot commented Jan 26, 2024

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

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 91.0% (+0.08%) from 90.92%
when pulling 5015aa8 on fix-asarray-python-scalar-overflow
into b3acc6c on master.

Copy link

Array API standard conformance tests for dpctl=0.15.1dev3=py310h15de555_36 ran successfully.
Passed: 909
Failed: 0
Skipped: 86

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 , thanks for fixing gh-1512.

@oleksandr-pavlyk oleksandr-pavlyk changed the title Closes gh-1512 Fix array API test failure caused by issue reported in gh-1512 Jan 27, 2024
@ndgrigorian ndgrigorian merged commit 9b0a3cd into master Jan 27, 2024
45 of 47 checks passed
@ndgrigorian ndgrigorian deleted the fix-asarray-python-scalar-overflow branch January 27, 2024 00:41
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.

tensor.asarray raises unexpected TypeError for out of bound inputs
3 participants