code: def matrix_transpose(a):
      r"""
      Transposes a matrix (or a stack of matrices) `a`.
  
      Notes
      -----
      `matrix_transpose` is new in array API spec:
      https://data-apis.org/array-api/latest/extensions/linear_algebra_functions.html#linalg-matrix-transpose-x
      instead of an official NumPy operator. Unlike transpose, it only transposes the last two axes.
  
      Parameters
      ----------
      a : ndarray
          Input array having shape (..., M, N) and whose innermost two dimensions form MxN matrices.
  
      Returns
      ----------
      out : ndarray
          An array containing the transpose for each matrix and having shape (..., N, M).
          The returned array must have the same data type as `a`.
  
      Examples
      --------
      >>> x = np.arange(4).reshape((2,2))
      >>> x
      array([[0., 1.],
             [2., 3.]])
      >>> np.linalg.matrix_transpose(x)
      array([[0., 2.],
             [1., 3.]])
      >>> x = np.ones((1, 2, 3))
      >>> np.linalg.matrix_transpose(x)
      array([[[1., 1.],
              [1., 1.],
              [1., 1.]]])
      """
      if a.ndim < 2:
          raise ValueError(
              "x must be at least 2-dimensional for matrix_transpose"
          )
      return _mx_nd_np.swapaxes(a, -1, -2)
  
imports: from functools import reduce
  from ..ndarray import numpy
  from ..util import wrap_data_api_linalg_func
  from .fallback_linalg import *
  from .None import fallback_linalg
label_desc: Use image node_id 2 for calling a global function with example usage: matrix_transpose(a) and returns: _mx_nd_np