You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/API_specification/linear_algebra_functions.md
+17-21
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,23 @@ The `matmul` function must implement the same semantics as the built-in `@` oper
60
60
- if `x1` is a one-dimensional array having shape `(N)`, `x2` is a one-dimensional array having shape `(M)`, and `N != M`.
61
61
- if `x1` is an array having shape `(..., M, K)`, `x2` is an array having shape `(..., L, N)`, and `K != L`.
62
62
63
+
(function-matrix-transpose)=
64
+
### matrix_transpose(x, /)
65
+
66
+
Transposes a matrix (or a stack of matrices) `x`.
67
+
68
+
#### Parameters
69
+
70
+
-**x**: _<array>_
71
+
72
+
- input array having shape `(..., M, N)` and whose innermost two dimensions form `MxN` matrices.
73
+
74
+
#### Returns
75
+
76
+
-**out**: _<array>_
77
+
78
+
- an array containing the transpose for each matrix and having shape `(..., N, M)`. The returned array must have the same data type as `x`.
79
+
63
80
(function-tensordot)=
64
81
### tensordot(x1, x2, /, *, axes=2)
65
82
@@ -93,27 +110,6 @@ Returns a tensor contraction of `x1` and `x2` over specific axes.
93
110
94
111
- an array containing the tensor contraction whose shape consists of the non-contracted axes (dimensions) of the first array `x1`, followed by the non-contracted axes (dimensions) of the second array `x2`. The returned array must have a data type determined by {ref}`type-promotion`.
95
112
96
-
(function-transpose)=
97
-
### transpose(x, /, *, axes=None)
98
-
99
-
Transposes (or permutes the axes (dimensions)) of an array `x`.
100
-
101
-
#### Parameters
102
-
103
-
-**x**: _<array>_
104
-
105
-
- input array.
106
-
107
-
-**axes**: _Optional\[ Tuple\[ int, ... ]]_
108
-
109
-
- tuple containing a permutation of `(0, 1, ..., N-1)` where `N` is the number of axes (dimensions) of `x`. If `None`, the axes (dimensions) must be permuted in reverse order (i.e., equivalent to setting `axes=(N-1, ..., 1, 0)`). Default: `None`.
110
-
111
-
#### Returns
112
-
113
-
-**out**: _<array>_
114
-
115
-
- an array containing the transpose. The returned array must have the same data type as `x`.
Copy file name to clipboardExpand all lines: spec/extensions/linear_algebra_functions.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -357,6 +357,11 @@ Computes the rank (i.e., number of non-zero singular values) of a matrix (or a s
357
357
358
358
- an array containing the ranks. The returned array must have a floating-point data type determined by {ref}`type-promotion` and must have shape `(...)` (i.e., must have a shape equal to `shape(x)[:-2]`).
359
359
360
+
(function-linalg-matrix-transpose)=
361
+
### linalg.matrix_transpose(x, /)
362
+
363
+
Alias for {ref}`function-matrix-transpose`.
364
+
360
365
(function-linalg-outer)=
361
366
### linalg.outer(x1, x2, /)
362
367
@@ -562,11 +567,6 @@ Returns the sum along the specified diagonals of a matrix (or a stack of matrice
562
567
563
568
The returned array must have the same data type as `x`.
0 commit comments