dpnp.ndarray.transpose

ndarray.transpose(*axes)

Returns a view of the array with axes transposed.

For full documentation refer to numpy.ndarray.transpose.

Returns:

y – View of the array with its axes suitably permuted.

Return type:

dpnp.ndarray

See also

dpnp.transpose

Equivalent function.

dpnp.ndarray.ndarray.T

Array property returning the array transposed.

dpnp.ndarray.reshape

Give a new shape to an array without changing its data.

Examples

>>> import dpnp as dp
>>> a = dp.array([[1, 2], [3, 4]])
>>> a
array([[1, 2],
       [3, 4]])
>>> a.transpose()
array([[1, 3],
       [2, 4]])
>>> a.transpose((1, 0))
array([[1, 3],
       [2, 4]])
>>> a = dp.array([1, 2, 3, 4])
>>> a
array([1, 2, 3, 4])
>>> a.transpose()
array([1, 2, 3, 4])