@@ -604,15 +604,20 @@ def _transpose_dispatcher(a, axes=None):
604
604
@array_function_dispatch (_transpose_dispatcher )
605
605
def transpose (a , axes = None ):
606
606
"""
607
- Permute the dimensions of an array.
607
+ Reverse or permute the axes of an array; returns the modified array.
608
+
609
+ For an array a with two axes, transpose(a) gives the matrix transpose.
608
610
609
611
Parameters
610
612
----------
611
613
a : array_like
612
614
Input array.
613
- axes : list of ints, optional
614
- By default, reverse the dimensions, otherwise permute the axes
615
- according to the values given.
615
+ axes : tuple or list of ints, optional
616
+ If specified, it must be a tuple or list which contains a permutation of
617
+ [0,1,..,N-1] where N is the number of axes of a. The i'th axis of the
618
+ returned array will correspond to the axis numbered ``axes[i]`` of the
619
+ input. If not specified, defaults to ``range(a.ndim)[::-1]``, which
620
+ reverses the order of the axes.
616
621
617
622
Returns
618
623
-------
@@ -797,7 +802,7 @@ def argpartition(a, kth, axis=-1, kind='introselect', order=None):
797
802
partition : Describes partition algorithms used.
798
803
ndarray.partition : Inplace partition.
799
804
argsort : Full indirect sort.
800
- take_along_axis : Apply ``index_array`` from argpartition
805
+ take_along_axis : Apply ``index_array`` from argpartition
801
806
to an array as if by calling partition.
802
807
803
808
Notes
@@ -1039,7 +1044,7 @@ def argsort(a, axis=-1, kind=None, order=None):
1039
1044
lexsort : Indirect stable sort with multiple keys.
1040
1045
ndarray.sort : Inplace sort.
1041
1046
argpartition : Indirect partial sort.
1042
- take_along_axis : Apply ``index_array`` from argsort
1047
+ take_along_axis : Apply ``index_array`` from argsort
1043
1048
to an array as if by calling sort.
1044
1049
1045
1050
Notes
@@ -1136,7 +1141,7 @@ def argmax(a, axis=None, out=None):
1136
1141
ndarray.argmax, argmin
1137
1142
amax : The maximum value along a given axis.
1138
1143
unravel_index : Convert a flat index into an index tuple.
1139
- take_along_axis : Apply ``np.expand_dims(index_array, axis)``
1144
+ take_along_axis : Apply ``np.expand_dims(index_array, axis)``
1140
1145
from argmax to an array as if by calling max.
1141
1146
1142
1147
Notes
@@ -1217,7 +1222,7 @@ def argmin(a, axis=None, out=None):
1217
1222
ndarray.argmin, argmax
1218
1223
amin : The minimum value along a given axis.
1219
1224
unravel_index : Convert a flat index into an index tuple.
1220
- take_along_axis : Apply ``np.expand_dims(index_array, axis)``
1225
+ take_along_axis : Apply ``np.expand_dims(index_array, axis)``
1221
1226
from argmin to an array as if by calling min.
1222
1227
1223
1228
Notes
0 commit comments