Skip to content

Conversation

@vlad-perevezentsev
Copy link
Contributor

This PR suggests raising DeprecationWarning for .T property on dpnp.ndarray other than 2D and in a future release will raise an error according to the Python Array API

  • 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 Nov 21, 2025

Array API standard conformance tests for dpnp=0.20.0dev1=py313h509198e_8 ran successfully.
Passed: 1229
Failed: 0
Skipped: 7

@coveralls
Copy link
Collaborator

coveralls commented Nov 21, 2025

Coverage Status

coverage: 81.452% (+0.002%) from 81.45%
when pulling 28850c6 on depr_T_non_2dim
into d99fa65 on master.

@github-actions
Copy link
Contributor

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

Copy link
Contributor

@antonwolfy antonwolfy 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 @vlad-perevezentsev
LGTM with a small nit


* `dpnp.asfarray` is deprecated. Use `dpnp.asarray` with an appropriate dtype instead [#2650](https://github.com/IntelPython/dpnp/pull/2650)
* Passing the output array ``out`` positionally to `dpnp.minimum` and `dpnp.maximum` is deprecated. Pass the output with the keyword form, e.g. ``dpnp.minimum(a, b, out=c)`` [#2659](https://github.com/IntelPython/dpnp/pull/2659)
* Using the `.T` property on non-2D `dpnp.ndarray` is deprecated. Use `self.transpose()` or `self.mT` instead [#2681](https://github.com/IntelPython/dpnp/pull/2681)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add more details:

Suggested change
* Using the `.T` property on non-2D `dpnp.ndarray` is deprecated. Use `self.transpose()` or `self.mT` instead [#2681](https://github.com/IntelPython/dpnp/pull/2681)
* `dpnp.ndarray.T` property is deprecated for not two-dimensional array to be compatible with the Python array API standard. To achieve a similar behavior when ``a.ndim != 2``, either ``a.transpose()``, or ``a.mT`` (swaps the last two axes only), or ``dpnp.permute_dims(a, range(a.ndim)[::-1])`` can be used. [#2681](https://github.com/IntelPython/dpnp/pull/2681)

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