def lu(x, pivot=True, get_infos=False, name=None):
    "\n    Computes the LU factorization of an N-D(N>=2) matrix x. \n\n    Returns the LU factorization(inplace x) and Pivots. low triangular matrix L and \n    upper triangular matrix U are combined to a single LU matrix.\n\n    Pivoting is done if pivot is set to True.\n    P mat can be get by pivots:\n    # ones = eye(rows) #eye matrix of rank rows\n    # for i in range(cols):\n    #     swap(ones[i], ones[pivots[i]])\n    # return ones\n\n    Args:\n\n        X (Tensor): the tensor to factor of N-dimensions(N>=2).\n\n        pivot (bool, optional): controls whether pivoting is done. Default: True.\n\n        get_infos (bool, optional): if set to True, returns an info IntTensor. Default: False.\n\n        name (str, optional): Name for the operation (optional, default is None).\n            For more information, please refer to :ref:`api_guide_Name`.\n            \n    Returns:\n        factorization (Tensor): LU matrix, the factorization of input X.\n\n        pivots (IntTensor): the pivots of size(∗(N-2), min(m,n)). `pivots` stores all the \n                    intermediate transpositions of rows. The final permutation `perm` could be \n                    reconstructed by this, details refer to upper example.\n\n        infos (IntTensor, optional): if `get_infos` is `True`, this is a tensor of size (∗(N-2)) \n                    where non-zero values indicate whether factorization for the matrix or each minibatch \n                    has succeeded or failed.\n\n        \n    Examples:            \n        .. code-block:: python\n\n            import paddle \n\n            x = paddle.to_tensor([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]).astype('float64')\n            lu,p,info = paddle.linalg.lu(x, get_infos=True)\n\n            # >>> lu:\n            # Tensor(shape=[3, 2], dtype=float64, place=CUDAPlace(0), stop_gradient=True,\n            #    [[5.        , 6.        ],\n            #        [0.20000000, 0.80000000],\n            #        [0.60000000, 0.50000000]])\n            # >>> p\n            # Tensor(shape=[2], dtype=int32, place=CUDAPlace(0), stop_gradient=True,\n            #    [3, 3])\n            # >>> info\n            # Tensor(shape=[], dtype=int32, place=CUDAPlace(0), stop_gradient=True,\n            #    0)\n            \n            P,L,U = paddle.linalg.lu_unpack(lu,p)\n\n            # >>> P\n            # (Tensor(shape=[3, 3], dtype=float64, place=CUDAPlace(0), stop_gradient=True,\n            # [[0., 1., 0.],\n            # [0., 0., 1.],\n            # [1., 0., 0.]]), \n            # >>> L\n            # Tensor(shape=[3, 2], dtype=float64, place=CUDAPlace(0), stop_gradient=True,\n            # [[1.        , 0.        ],\n            # [0.20000000, 1.        ],\n            # [0.60000000, 0.50000000]]), \n            # >>> U\n            # Tensor(shape=[2, 2], dtype=float64, place=CUDAPlace(0), stop_gradient=True,\n            # [[5.        , 6.        ],\n            # [0.        , 0.80000000]]))\n            \n\n            # one can verify : X = P @ L @ U ;     \n    "
    if paddle.in_dynamic_mode():
        (LU, Piv, Info) = _C_ops.lu(x, 'pivots', pivot)
        if get_infos:
            return (LU, Piv, Info)
        else:
            return (LU, Piv)
    check_variable_and_dtype(x, 'dtype', ['float32', 'float64'], 'lu')
    helper = LayerHelper('lu', **locals())
    lu = helper.create_variable_for_type_inference(dtype=x.dtype)
    p = helper.create_variable_for_type_inference(dtype='int')
    info = helper.create_variable_for_type_inference(dtype='int')
    attrs = dict()
    attrs['pivots'] = pivot
    helper.append_op(type='lu', inputs={'X': x}, outputs={'Out': lu, 'Pivots': p, 'Infos': info}, attrs=attrs)
    if get_infos:
        return (lu, p, info)
    else:
        return (lu, p)
Computes the LU factorization of an N-D(N>=2) matrix x. 

Returns the LU factorization(inplace x) and Pivots. low triangular matrix L and 
upper triangular matrix U are combined to a single LU matrix.

Pivoting is done if pivot is set to True.
P mat can be get by pivots:
# ones = eye(rows) #eye matrix of rank rows
# for i in range(cols):
#     swap(ones[i], ones[pivots[i]])
# return ones

Args:

    X (Tensor): the tensor to factor of N-dimensions(N>=2).

    pivot (bool, optional): controls whether pivoting is done. Default: True.

    get_infos (bool, optional): if set to True, returns an info IntTensor. Default: False.

    name (str, optional): Name for the operation (optional, default is None).
        For more information, please refer to :ref:`api_guide_Name`.
        
Returns:
    factorization (Tensor): LU matrix, the factorization of input X.

    pivots (IntTensor): the pivots of size(∗(N-2), min(m,n)). `pivots` stores all the 
                intermediate transpositions of rows. The final permutation `perm` could be 
                reconstructed by this, details refer to upper example.

    infos (IntTensor, optional): if `get_infos` is `True`, this is a tensor of size (∗(N-2)) 
                where non-zero values indicate whether factorization for the matrix or each minibatch 
                has succeeded or failed.

    
Examples:            
    .. code-block:: python

        import paddle 

        x = paddle.to_tensor([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]).astype('float64')
        lu,p,info = paddle.linalg.lu(x, get_infos=True)

        # >>> lu:
        # Tensor(shape=[3, 2], dtype=float64, place=CUDAPlace(0), stop_gradient=True,
        #    [[5.        , 6.        ],
        #        [0.20000000, 0.80000000],
        #        [0.60000000, 0.50000000]])
        # >>> p
        # Tensor(shape=[2], dtype=int32, place=CUDAPlace(0), stop_gradient=True,
        #    [3, 3])
        # >>> info
        # Tensor(shape=[], dtype=int32, place=CUDAPlace(0), stop_gradient=True,
        #    0)
        
        P,L,U = paddle.linalg.lu_unpack(lu,p)

        # >>> P
        # (Tensor(shape=[3, 3], dtype=float64, place=CUDAPlace(0), stop_gradient=True,
        # [[0., 1., 0.],
        # [0., 0., 1.],
        # [1., 0., 0.]]), 
        # >>> L
        # Tensor(shape=[3, 2], dtype=float64, place=CUDAPlace(0), stop_gradient=True,
        # [[1.        , 0.        ],
        # [0.20000000, 1.        ],
        # [0.60000000, 0.50000000]]), 
        # >>> U
        # Tensor(shape=[2, 2], dtype=float64, place=CUDAPlace(0), stop_gradient=True,
        # [[5.        , 6.        ],
        # [0.        , 0.80000000]]))
        

        # one can verify : X = P @ L @ U ;
def lu(x, pivot=True, get_infos=False, name=None):
    "\n    Computes the LU factorization of an N-D(N>=2) matrix x. \n\n    Returns the LU factorization(inplace x) and Pivots. low triangular matrix L and \n    upper triangular matrix U are combined to a single LU matrix.\n\n    Pivoting is done if pivot is set to True.\n    P mat can be get by pivots:\n    # ones = eye(rows) #eye matrix of rank rows\n    # for i in range(cols):\n    #     swap(ones[i], ones[pivots[i]])\n    # return ones\n\n    Args:\n\n        X (Tensor): the tensor to factor of N-dimensions(N>=2).\n\n        pivot (bool, optional): controls whether pivoting is done. Default: True.\n\n        get_infos (bool, optional): if set to True, returns an info IntTensor. Default: False.\n\n        name (str, optional): Name for the operation (optional, default is None).\n            For more information, please refer to :ref:`api_guide_Name`.\n            \n    Returns:\n        factorization (Tensor): LU matrix, the factorization of input X.\n\n        pivots (IntTensor): the pivots of size(∗(N-2), min(m,n)). `pivots` stores all the \n                    intermediate transpositions of rows. The final permutation `perm` could be \n                    reconstructed by this, details refer to upper example.\n\n        infos (IntTensor, optional): if `get_infos` is `True`, this is a tensor of size (∗(N-2)) \n                    where non-zero values indicate whether factorization for the matrix or each minibatch \n                    has succeeded or failed.\n\n        \n    Examples:            \n        .. code-block:: python\n\n            import paddle \n\n            x = paddle.to_tensor([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]).astype('float64')\n            lu,p,info = paddle.linalg.lu(x, get_infos=True)\n\n            # >>> lu:\n            # Tensor(shape=[3, 2], dtype=float64, place=CUDAPlace(0), stop_gradient=True,\n            #    [[5.        , 6.        ],\n            #        [0.20000000, 0.80000000],\n            #        [0.60000000, 0.50000000]])\n            # >>> p\n            # Tensor(shape=[2], dtype=int32, place=CUDAPlace(0), stop_gradient=True,\n            #    [3, 3])\n            # >>> info\n            # Tensor(shape=[], dtype=int32, place=CUDAPlace(0), stop_gradient=True,\n            #    0)\n            \n            P,L,U = paddle.linalg.lu_unpack(lu,p)\n\n            # >>> P\n            # (Tensor(shape=[3, 3], dtype=float64, place=CUDAPlace(0), stop_gradient=True,\n            # [[0., 1., 0.],\n            # [0., 0., 1.],\n            # [1., 0., 0.]]), \n            # >>> L\n            # Tensor(shape=[3, 2], dtype=float64, place=CUDAPlace(0), stop_gradient=True,\n            # [[1.        , 0.        ],\n            # [0.20000000, 1.        ],\n            # [0.60000000, 0.50000000]]), \n            # >>> U\n            # Tensor(shape=[2, 2], dtype=float64, place=CUDAPlace(0), stop_gradient=True,\n            # [[5.        , 6.        ],\n            # [0.        , 0.80000000]]))\n            \n\n            # one can verify : X = P @ L @ U ;     \n    "
    if paddle.in_dynamic_mode():
        (LU, Piv, Info) = _C_ops.lu(x, 'pivots', pivot)
        if get_infos:
            return (LU, Piv, Info)
        else:
            return (LU, Piv)
    check_variable_and_dtype(x, 'dtype', ['float32', 'float64'], 'lu')
    helper = LayerHelper('lu', **locals())
    lu = helper.create_variable_for_type_inference(dtype=x.dtype)
    p = helper.create_variable_for_type_inference(dtype='int')
    info = helper.create_variable_for_type_inference(dtype='int')
    attrs = dict()
    attrs['pivots'] = pivot
    helper.append_op(type='lu', inputs={'X': x}, outputs={'Out': lu, 'Pivots': p, 'Infos': info}, attrs=attrs)
    if get_infos:
        return (lu, p, info)
    else:
        return (lu, p)