Skip to content

Address NumPy 1.25 deprecation warnings #1368

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

Merged

Conversation

oleksandr-pavlyk
Copy link
Contributor

Ensure that ndarray that we converted usm_ndarray single element instance into is 0d before calling __int__, __float__, __complex__, __index__.

In [1]: import numpy as np

In [2]: np.__version__
Out[2]: '1.25.2'

In [3]: int(np.arange(1,2))
<ipython-input-3-5727c43c7d79>:1: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
  int(np.arange(1,2))
Out[3]: 1

In [4]: int(np.reshape(np.arange(1,2), tuple()))
Out[4]: 1

In [5]: int(np.arange(1,2))
<ipython-input-5-5727c43c7d79>:1: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
  int(np.arange(1,2))
Out[5]: 1
  • 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?

Ensure that ndarray that we converted usm_ndarray single element instance
into  is 0d before calling __int__, __float__, __complex__, __index__.
@github-actions
Copy link

@coveralls
Copy link
Collaborator

coveralls commented Aug 25, 2023

Coverage Status

coverage: 85.634% (-0.002%) from 85.636% when pulling a653eb3 on scalar_special_methods_required_zero_dim_ndarray into 1595dce on master.

@ndgrigorian
Copy link
Collaborator

@oleksandr-pavlyk
test_usm_ndarray_ctor seems to still have some warnings in the CI. Much fewer than before though.

@github-actions
Copy link

Array API standard conformance tests for dpctl=0.14.6dev4=py310ha25a700_15 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

This is to address NumPy 1.25 deprecation warnings.
@github-actions
Copy link

Array API standard conformance tests for dpctl=0.14.6dev4=py310ha25a700_16 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

@oleksandr-pavlyk oleksandr-pavlyk force-pushed the scalar_special_methods_required_zero_dim_ndarray branch from 23679de to a653eb3 Compare August 25, 2023 21:34
@github-actions
Copy link

Array API standard conformance tests for dpctl=0.14.6dev4=py310ha25a700_18 ran successfully.
Passed: 916
Failed: 84
Skipped: 119

Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

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

The warnings seem to be gone

Thank you @oleksandr-pavlyk !

@oleksandr-pavlyk oleksandr-pavlyk merged commit cf4660d into master Aug 25, 2023
@oleksandr-pavlyk oleksandr-pavlyk deleted the scalar_special_methods_required_zero_dim_ndarray branch August 25, 2023 23:33
@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.6dev4=py310ha25a700_18 ran successfully.
Passed: 916
Failed: 84
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.

3 participants