parameters: (a, name="matrix_transpose", conjugate=False)
docstring: Transposes last two dimensions of tensor `a`.
  
    For example:
  
    ```python
    x = tf.constant([[1, 2, 3], [4, 5, 6]])
    tf.matrix_transpose(x)  # [[1, 4],
                            #  [2, 5],
                            #  [3, 6]]
  
    x = tf.constant([[1 + 1j, 2 + 2j, 3 + 3j],
                     [4 + 4j, 5 + 5j, 6 + 6j]])
    tf.matrix_transpose(x, conjugate=True)  # [[1 - 1j, 4 - 4j],
                                            #  [2 - 2j, 5 - 5j],
                                            #  [3 - 3j, 6 - 6j]]
  
    # Matrix with two batch dimensions.
    # x.shape is [1, 2, 3, 4]
    # tf.matrix_transpose(x) is shape [1, 2, 4, 3]
    ```
  
    Note that `tf.matmul` provides kwargs allowing for transpose of arguments.
    This is done with minimal cost, and is preferable to using this function. E.g.
  
    ```python
    # Good!  Transpose is taken at minimal additional cost.
    tf.matmul(matrix, b, transpose_b=True)
  
    # Inefficient!
    tf.matmul(matrix, tf.matrix_transpose(b))
    ```
  
    Args:
      a: A `Tensor` with `rank >= 2`.
      name: A name for the operation (optional).
      conjugate: Optional bool. Setting it to `True` is mathematically equivalent
        to tf.conj(tf.matrix_transpose(input)).
  
    Returns:
      A transposed batch matrix `Tensor`.
  
    Raises:
      ValueError:  If `a` is determined statically to have `rank < 2`.
docstring_summary: Transposes last two dimensions of tensor `a`.
docstring_tokens: Transposes last two dimensions of tensor a .
function: def matrix_transpose(a, name="matrix_transpose", conjugate=False):
    """Transposes last two dimensions of tensor `a`.
  
    For example:
  
    ```python
    x = tf.constant([[1, 2, 3], [4, 5, 6]])
    tf.matrix_transpose(x)  # [[1, 4],
                            #  [2, 5],
                            #  [3, 6]]
  
    x = tf.constant([[1 + 1j, 2 + 2j, 3 + 3j],
                     [4 + 4j, 5 + 5j, 6 + 6j]])
    tf.matrix_transpose(x, conjugate=True)  # [[1 - 1j, 4 - 4j],
                                            #  [2 - 2j, 5 - 5j],
                                            #  [3 - 3j, 6 - 6j]]
  
    # Matrix with two batch dimensions.
    # x.shape is [1, 2, 3, 4]
    # tf.matrix_transpose(x) is shape [1, 2, 4, 3]
    ```
  
    Note that `tf.matmul` provides kwargs allowing for transpose of arguments.
    This is done with minimal cost, and is preferable to using this function. E.g.
  
    ```python
    # Good!  Transpose is taken at minimal additional cost.
    tf.matmul(matrix, b, transpose_b=True)
  
    # Inefficient!
    tf.matmul(matrix, tf.matrix_transpose(b))
    ```
  
    Args:
      a: A `Tensor` with `rank >= 2`.
      name: A name for the operation (optional).
      conjugate: Optional bool. Setting it to `True` is mathematically equivalent
        to tf.conj(tf.matrix_transpose(input)).
  
    Returns:
      A transposed batch matrix `Tensor`.
  
    Raises:
      ValueError:  If `a` is determined statically to have `rank < 2`.
    """
    with ops.name_scope(name, values=[a]):
      a = ops.convert_to_tensor(a, name="a")
  
      # If we know the number of dimensions (statically), we can do two things:
      # 1. Check that `a` is a (batch) matrix.
      # 2. Use a python list for perm.  This preserves static shape information
      #    and avoids extra computations.
      a_shape = a.get_shape()
      ndims = a_shape.ndims
      if ndims is not None:
        if ndims < 2:
          raise ValueError(
              "Argument 'a' should be a (batch) matrix, with rank >= 2.  Found: "
              "%s" % a_shape)
        perm = list(range(ndims - 2)) + [ndims - 1] + [ndims - 2]
      else:
        a_rank = rank(a)
        perm = concat((gen_math_ops._range(0, a_rank - 2, 1),
                       [a_rank - 1, a_rank - 2]), 0)
  
      return transpose(a, perm=perm, conjugate=conjugate)
function_tokens: def matrix_transpose ( a , name = "matrix_transpose" , conjugate = False ) : with ops . name_scope ( name , values = [ a ] ) : a = ops . convert_to_tensor ( a , name = "a" ) # If we know the number of dimensions (statically), we can do two things: # 1. Check that `a` is a (batch) matrix. # 2. Use a python list for perm.  This preserves static shape information #    and avoids extra computations. a_shape = a . get_shape ( ) ndims = a_shape . ndims if ndims is not None : if ndims < 2 : raise ValueError ( "Argument 'a' should be a (batch) matrix, with rank >= 2.  Found: " "%s" % a_shape ) perm = list ( range ( ndims - 2 ) ) + [ ndims - 1 ] + [ ndims - 2 ] else : a_rank = rank ( a ) perm = concat ( ( gen_math_ops . _range ( 0 , a_rank - 2 , 1 ) , [ a_rank - 1 , a_rank - 2 ] ) , 0 ) return transpose ( a , perm = perm , conjugate = conjugate )