Skip to content

Conversation

@vlad-perevezentsev
Copy link
Contributor

This PR deprecates setting the strides attribute of dpnp array (following NumPy 2.4)

  • 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?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?

@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2026

View rendered docs @ https://intelpython.github.io/dpnp/index.html

@github-actions
Copy link
Contributor

Array API standard conformance tests for dpnp=0.20.0dev1=py313h509198e_56 ran successfully.
Passed: 1227
Failed: 0
Skipped: 9

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 81.098% (+0.003%) from 81.095%
when pulling 3acb0a0 on depr_strides_set
into a97953e on master.

def test_set_strides_deprecated(self):
x = dpnp.eye(2)
with pytest.warns(DeprecationWarning, match="Setting the strides"):
setattr(x, "strides", x.strides)
Copy link
Contributor

Choose a reason for hiding this comment

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

We need some validation the strides really changed

@vlad-perevezentsev
Copy link
Contributor Author

After investigation setting strides is already not supported in dpnp:
dpnp_array.strides os a read-only property without a setter

a.strides = (1,2)
# AttributeError: property 'strides' of 'dpnp_array' object has no setter

dpctl.tensor.usm_ndarray.strides is also not writable

a.get_array().strides = (1,2)
# AttributeError: attribute 'strides' of 'dpctl.tensor._usmarray.usm_ndarray' objects is not writable

so no additional deprecation logic is needed

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