From 550531c5a20277e4356ea0f14cdb4eeba4dbce29 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 4 Jun 2026 05:40:04 -0700 Subject: [PATCH 1/3] Mention negative axis support in transpose/permute_dims docs --- dpnp/dpnp_iface_manipulation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dpnp/dpnp_iface_manipulation.py b/dpnp/dpnp_iface_manipulation.py index b96d36a40e6..4c0522b242b 100644 --- a/dpnp/dpnp_iface_manipulation.py +++ b/dpnp/dpnp_iface_manipulation.py @@ -3908,6 +3908,7 @@ def transpose(a, axes=None): axes : {None, tuple or list of ints}, optional If specified, it must be a tuple or list which contains a permutation of [0, 1, ..., N-1] where N is the number of axes of `a`. + Negative indices can also be used to specify axes. The `i`'th axis of the returned array will correspond to the axis numbered ``axes[i]`` of the input. If not specified or ``None``, defaults to ``range(a.ndim)[::-1]``, which reverses the order of From ff884378d7a60c8d77ab05186197f040fe8d4cd1 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 4 Jun 2026 05:50:51 -0700 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef8b88bc9e3..6a137fb1cdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This release is compatible with NumPy 2.4.5. * Updated tests to align with NumPy 2.4.5 compatibility [gh-2920](https://github.com/IntelPython/dpnp/pull/2920) * Replaced `.pxi` includes in `dpnp.tensor` with modular `.pxd`/`.pyx` Cython imports [#2913](https://github.com/IntelPython/dpnp/pull/2913) * Reimplemented `dpnp.eye` and `dpnp.tensor.eye` with a branchless kernel [gh-2937](https://github.com/IntelPython/dpnp/pull/2937) +* Clarified support for negative axes in `dpnp.transpose`/`dpnp.permute_dims` documentation [#2940](https://github.com/IntelPython/dpnp/pull/2940) ### Deprecated From 70eecbe3f4efc06c7d9b049efcfd139143b3863d Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Fri, 12 Jun 2026 04:59:29 -0700 Subject: [PATCH 3/3] Apply remarks --- dpnp/dpnp_array.py | 1 + dpnp/dpnp_iface_manipulation.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/dpnp/dpnp_array.py b/dpnp/dpnp_array.py index 899379e837e..00401c6c790 100644 --- a/dpnp/dpnp_array.py +++ b/dpnp/dpnp_array.py @@ -2384,6 +2384,7 @@ def transpose(self, *axes): * ``tuple or list of ints``: `i` in the `j`-th place in the tuple/list means that the array’s `i`-th axis becomes the transposed array’s `j`-th axis. + Negative indices can also be used to specify axes. * ``n ints``: same as an n-tuple/n-list of the same integers (this form is intended simply as a “convenience” alternative to the tuple form). diff --git a/dpnp/dpnp_iface_manipulation.py b/dpnp/dpnp_iface_manipulation.py index 4c0522b242b..14a190993ed 100644 --- a/dpnp/dpnp_iface_manipulation.py +++ b/dpnp/dpnp_iface_manipulation.py @@ -3952,6 +3952,10 @@ def transpose(a, axes=None): >>> np.transpose(a).shape (5, 4, 3, 2) + >>> a = np.arange(3*4*5).reshape((3, 4, 5)) + >>> np.transpose(a, (-1, 0, -2)).shape + (5, 3, 4) + """ dpnp.check_supported_arrays_type(a)