parameters: (mat, static_batch_shape)
return_statement: return vector
docstring: Flip matrix to vector with static shapes.
docstring_summary: Flip matrix to vector with static shapes.
docstring_tokens: Flip matrix to vector with static shapes .
function: def _flip_matrix_to_vector_static(mat, static_batch_shape):
    """Flip matrix to vector with static shapes."""
    mat_rank = mat.get_shape().ndims
    k = mat.get_shape()[-2]
    final_shape = static_batch_shape.concatenate(k)
  
    # mat.shape = matrix_batch_shape + [k, M]
    # Permutation corresponding to [M] + matrix_batch_shape + [k]
    perm = [mat_rank - 1] + list(range(0, mat_rank - 1))
    mat_with_end_at_beginning = array_ops.transpose(mat, perm=perm)
    vector = array_ops.reshape(mat_with_end_at_beginning, final_shape)
    return vector
function_tokens: def _flip_matrix_to_vector_static ( mat , static_batch_shape ) : mat_rank = mat . get_shape ( ) . ndims k = mat . get_shape ( ) [ - 2 ] final_shape = static_batch_shape . concatenate ( k ) # mat.shape = matrix_batch_shape + [k, M] # Permutation corresponding to [M] + matrix_batch_shape + [k] perm = [ mat_rank - 1 ] + list ( range ( 0 , mat_rank - 1 ) ) mat_with_end_at_beginning = array_ops . transpose ( mat , perm = perm ) vector = array_ops . reshape ( mat_with_end_at_beginning , final_shape ) return vector