bundles / numpy latest / numpy / matrix_transpose
_ArrayFunctionDispatcher
numpy:matrix_transpose
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/_core/fromnumeric.py :683
Signature
def matrix_transpose ( x , / ) Summary
Transposes a matrix (or a stack of matrices) x.
Extended Summary
This function is Array API compatible.
Parameters
x: array_likeInput array having shape (..., M, N) and whose two innermost dimensions form
MxNmatrices.
Returns
out: ndarrayAn array containing the transpose for each matrix and having shape (..., N, M).
Examples
import numpy as np np.matrix_transpose([[1, 2], [3, 4]])✓
np.matrix_transpose([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
✗See also
- transpose
Generic transpose method.
Aliases
-
numpy.matrix_transpose