numpy.linalg.matrix_transpose#
- linalg.matrix_transpose(x, /)[原始碼]#
轉置矩陣(或矩陣堆疊)``x``
This function is Array API compatible.
- 參數:
- xarray_like
Input array having shape (…, M, N) and whose two innermost dimensions form
MxNmatrices.
- 回傳值:
- outndarray
An array containing the transpose for each matrix and having shape (…, N, M).
也參考
transposeGeneric transpose method.
Notes
This function is an alias of
numpy.matrix_transpose.範例
>>> import numpy as np >>> np.matrix_transpose([[1, 2], [3, 4]]) array([[1, 3], [2, 4]])
>>> np.matrix_transpose([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) array([[[1, 3], [2, 4]], [[5, 7], [6, 8]]])