Skip to content

improve coverage dpnp_iface_manipulation.py #2175

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
merged 4 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions dpnp/dpnp_iface_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3848,13 +3848,14 @@ def transpose(a, axes=None):
----------
a : {dpnp.ndarray, usm_ndarray}
Input array.
axes : None, tuple or list of ints, optional
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`.
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
the axes.
Default: ``None``.

Returns
-------
Expand Down Expand Up @@ -3894,18 +3895,13 @@ def transpose(a, axes=None):

"""

if isinstance(a, dpnp_array):
array = a
elif isinstance(a, dpt.usm_ndarray):
array = dpnp_array._create_from_usm_ndarray(a)
else:
raise TypeError(
f"An array must be any of supported type, but got {type(a)}"
)
dpnp.check_supported_arrays_type(a)
if isinstance(a, dpt.usm_ndarray):
a = dpnp_array._create_from_usm_ndarray(a)

if axes is None:
return array.transpose()
return array.transpose(*axes)
return a.transpose()
return a.transpose(*axes)


permute_dims = transpose # permute_dims is an alias for transpose
Expand Down
Loading
Loading