
    ёiV|             
          S SK Jr  S SKrS SKrS SKrS SKJrJr  S SKr	S SK
r
S SK
Jr  S SKJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJr  S SK J!r!  S SK"J#r#J$r$  S SK%J&r&  S S	K'J(r(J)r)J*r*J+r+  S S
K,J-r-  SSK.J/r/J0r0J1r1J2r2  SSK3J4r4  SSK5J6r6J7r7J8r8J9r9J:r:J;r;  SSK<J=r=  SSK>J?r?  SSK@JArAJBrB  SSKCJDrDJErEJFrFJGrGJHrHJIrIJJrJJKrKJLrLJMrMJNrNJOrOJPrPJQrQJRrRJSrSJTrTJUrUJVrVJWrWJXrXJYrYJZrZJ[r[J\r\J]r]J^r^J_r_J`r`JaraJbrbJcrcJdrdJereJfrfJgrgJhrhJiriJjrjJkrkJlrlJmrmJnrnJoroJprp  \(       a  S SKqJrrr  S SKJsrs  S SK
Jtrt  S SKuJvrv  S SK'Jwrw  / rx\#R                  R                  \#R                  R                  \#R                  R                  \#R                  R                  \#R                  R                  /r\#R                  GR                   \#R                  GR                  /rS rS r\-SSS jj5       r     S             SS jjr   S         SS jjr S       SS jjr\-     S             SS  jj5       r\(" S!/S"/S#.5       SSS$.         SS& jjj5       r\-SSS' jj5       rS(S)S*S+S,S-S.S/S0S1.	rS2 r\+" SS!/S%S3/5       SSSS4.           SS5 jjj5       r\+" SS!/S%S3/5      \- SSS6.         SS7 jjj5       5       rSSS8 jjr\+" SS!/S%S3/5       SSSS4.           SS9 jjj5       r\+" SS!/S%S3/5      \- SSS6.         SS: jjj5       5       r\+" SS!/S%S3/5       SSSS;.           SS< jjj5       r\+" SS!/S%S3/5      \- SSS=.         SS> jjj5       5       rSS$.       SS? jjr\)" 5        SSS$.         SS@ jjj5       r\-SSSA jj5       r\+" SS!/S%S3/5       SSS$.         SSB jjj5       r\-SSSC jj5       r\r\r\rSD\l        \rSE\l        \+" SS!/S%S3/5       SSS$.         SSF jjj5       r\+" SS!/S%S3/5      \-SSSG jj5       5       rSSH jrSSI jrSSJ jrSSK jrSSL jrSSSM jjrSSSN jjrSSSO jjr    S           SSP jjr\-    S           SSQ jj5       r    S           SSS jjr   S         SST jjr   S         SSU jjrSSSV jjrSSSW jjr\-SSSX jj5       rSSSY jjr   S             SSZ jjr\-   S             SS[ jj5       r   S             SS\ jjr\-   S             SS] jj5       rSS^ jr\-SS_ j5       rSSS` jjr\(" S!/Sa/S#.5       SSS$.         SSb jjj5       rSSSc jjr\w" 1 SdkSeSfSgSh9   S         SSi jj5       r\w" 1 SdkSjSkSlSh9   S         SSm jj5       r\-SSSn jj5       r\-SSSo jj5       r\-SSSp jj5       r\*" SS!/5         SSS$.           SSq jjj5       r\-   S         SSr jj5       r\*" SS!/5          S           SSs jj5       rSSSt jjr\+" SS!/SRSu/5         SSS$.           SSv jjj5       r\-   S         SSw jj5       r   S         SSx jjr   S         SSy jjr   S         SSz jjr\*" SS!/5       SSSSS{.           SS| jjj5       r\-   S         SS} jj5       r\+" SS!/SRSu/5           S             SS~ jj5       r\-SSS jj5       rGS GSS jjrGSS jr      GSS jrSSS jjrSSS jjr\-SSS jj5       rSSS jjr\-SSS jj5       rSSS jjr\-SSS jj5       rSSS jjr\-SSS jj5       rSSS jjr\-SSS jj5       rSGSS jjr\-SGSS jj5       rSSS jjr\-SSS jj5       rSSS jjrSSS jjrSSS jjr GS       GSS jjr\- GS       GSS jj5       r S         GSS jjr\- S         GSS jj5       rSSS jjr\-SSS jj5       rSSS jjrSSS jjr\+" SS!/S%S3/5      SSS jj5       r\+" SS!/S%S3/5      SSS jj5       r\+" SS!/S%S3/5      SSS jj5       r\+" SS!/S%S3/5      SSS jj5       r\(" S!/Su/S.5           GSSS$.               GS	S jjj5       rSSS jjrSSS jjr\*" SS!/5       SSS$.       GS
S jjj5       r\-SSS jj5       rSSS jjr  GS         GSS jjrSGSS jjr    GS           GSS jjr    GS           GSS jjr    GS           GSS jjr   S         GSS jjrSSS jjrSSS jjr\-SSS jj5       rSSS jjrSSS jjrSSS jjrSGSS jjGr \-SGSS jj5       GrSSS jjGrSSS jjGrGSS jGr   GS           GSS jjGr\-   GS           GSS jj5       Gr   GS           GSS jjGr\-   GS           GSS jj5       Gr GS       GSS jjGr	 GS       GSS jjGr
 GS     GSS jjGr GS     GSS jjGrSGSS jjGr\-SSS jj5       GrSSS jjGr\-SSS jj5       Gr   GS         GSS jjGrSSS jjGrSSS jjGrSSS jjGrSSS jjGrSSS jjGr\-SSS jj5       Gr\+" SS/SS/5         GS           GSS jj5       GrSGSS jjGrg(      )annotationsN)TYPE_CHECKINGLiteral)_C_ops)allamaxaminanyisfiniteisinfisnanloglog1plog2log10	logsumexpmaximumminimummultiplysignsinsumtanh)DataType)VarDescdygraph_utils)Value)ParamAliasDecoratorfloor_divide_decoratorparam_one_aliasparam_two_alias)inplace_apis_in_dygraph_only   )check_dtype
check_typecheck_variable_and_dtypeconvert_dtype)Variable)LayerHelperconvert_np_dtype_to_dtype_corein_dynamic_modein_dynamic_or_pir_modein_pir_mode   )_complex_to_real_dtype)generate_layer_fn)castcast_)-absabs_acosacos_acoshacosh_asinasin_asinhasinh_atanatan_atanhatanh_ceilceil_coscos_coshcosh_erferf_expexp_expm1expm1_floorfloor_
reciprocalreciprocal_roundround_rsqrtrsqrt_sigmoidsigmoid_sin_sinhsinh_sqrtsqrt_squaresquare_tantan_)Sequence)Number)Tensor)	DTypeLike)ForbidKeywordsDecoratorc                N   U bl  [        U [        5      (       dW  [        U [        [        45      (       a  [        U 5      n O0[        U [        5      (       a  U /n O[        S[        U 5       35      eU c  / n U / :X  d"  [        U 5      [        UR                  5      :X  a  SnX 4$ SnX 4$ )zj
Internal function for max, min, amax and amin.
It computes the attribute reduce_all value based on axis.
z:The type of axis must be int, list or tuple, but received TF)	
isinstancelisttuplerangeint	TypeErrortypelenshapeaxisx
reduce_alls      R/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/paddle/tensor/math.py_get_reduce_axisru      s    
 
4 6 6dUEN++:Dc""6DLTRVZLY  |rzSY#agg,.
  
    c                   [        U [        [        R                  R                  45      (       aA  U R
                  / :w  a+  U R
                  S   [        UR
                  5      :X  a  SnX 4$ Sn X 4$ [        X5      u  p [        R                  R                  U 5      (       a  [        R                  R                  U 5      n X 4$ )Nr   TF)rg   r(   paddlepirr   ro   rn   ru   utils_contain_var_convert_to_tensor_listrp   s      rt   _get_reduce_axis_with_tensorr}      s    $6::#3#3455::

1QWW =J  J
  ,D4
<<$$T**<<77=Drv   rr   c                N    [        5       (       a  [        R                  " U 5      $ g)z}
Inplace version of ``log`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_log`.
N)r,   r   log_rr   names     rt   r   r      s      {{1~ rv   c                   [        5       (       a[  Uc!  [        R                  " X[        U5      U5      $ [        R                  " X[        U5      U5      n[        R
                  " Xd5      $ [        5       (       a@  [        R                  " X[        U5      U5      n[        R                  R                  Xd5      $ [        U S/ SQS5        SU /0n[        U5      US.n[        U[        5      (       a  U/US'   O[        U5      US'   [        S
0 [        5       D6n	U	R                  U R                   S9nU	R#                  SUSU0US	9  U	R%                  U5      $ )a  
Scale operator.

Putting scale and bias to the input Tensor as following:

``bias_after_scale`` is True:

.. math::
                        Out=scale*X+bias

``bias_after_scale`` is False:

.. math::
                        Out=scale*(X+bias)

Args:
    x (Tensor): Input N-D Tensor of scale operator. Data type can be bfloat16, float16, float32, float64, int8, int16, int32,
        int64, uint8, complex64, complex128.
    scale (float|Tensor): The scale factor of the input, it should be a float number or a 0-D Tensor with shape [] and data type as float32.
    bias (float): The bias to be put on the input.
    bias_after_scale (bool): Apply bias addition after or before scaling. It is useful for numeric stability in some circumstances.
    act (str|None, optional): Activation applied to the output such as tanh, softmax, sigmoid, relu.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: Output Tensor of scale operator, with shape and data type same as input.

Examples:
    .. code-block:: python

        >>> # scale as a float32 number
        >>> import paddle

        >>> data = paddle.arange(6).astype("float32").reshape([2, 3])
        >>> print(data)
        Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[0., 1., 2.],
         [3., 4., 5.]])
        >>> res = paddle.scale(data, scale=2.0, bias=1.0)
        >>> print(res)
        Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[1. , 3. , 5. ],
         [7. , 9. , 11.]])

    .. code-block:: python

        >>> # scale with parameter scale as a Tensor
        >>> import paddle

        >>> data = paddle.arange(6).astype("float32").reshape([2, 3])
        >>> print(data)
        Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[0., 1., 2.],
         [3., 4., 5.]])
        >>> factor = paddle.to_tensor([2], dtype='float32')
        >>> res = paddle.scale(data, scale=factor, bias=1.0)
        >>> print(res)
        Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[1. , 3. , 5. ],
         [7. , 9. , 11.]])

rr   )float16bfloat16uint16float32float64int8int16int32int64uint8	complex64
complex128scaleX)biasbias_after_scaleScaleTensordtypeOutrm   inputsoutputsattrsr   )r,   r   r   floatr   _append_activation_in_dygraphr.   rx   	pir_utilsappend_activation_in_pirr&   rg   r(   r)   locals"create_variable_for_type_inferencer   	append_opappend_activation)
rr   r   r   r   actr   outr   r   helpers
             rt   r   r      s?   N ;<<%+7GHHll1U4[2BC::3DD	ll1U4[2BC88BB  #	
& s$K 0
 eX&&%*GF=!"5\E'N1177agg7F%U 	 	
 '',,rv   c                    [        5       (       a  [        R                  " XU5      $ [        U S/ SQS5        [	        S	0 [        5       D6nUR                  U R                  S9nUR                  SSU 0SU0XS.S9  U$ )
a  

stanh activation.

.. math::

    out = b * \frac{e^{a * x} - e^{-a * x}}{e^{a * x} + e^{-a * x}}

Parameters:
    x (Tensor): The input Tensor with data type bfloat16, float16, float32, float64,
        uint8, int8, int16, int32, int64.
    scale_a (float, optional): The scale factor a of the input. Default is 0.67.
    scale_b (float, optional): The scale factor b of the output. Default is 1.7159.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    A Tensor with the same shape and data type as ``x`` (integer types are autocasted into float32).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([1.0, 2.0, 3.0, 4.0])
        >>> out = paddle.stanh(x, scale_a=0.67, scale_b=1.72)
        >>> print(out)
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [1.00616539, 1.49927628, 1.65933096, 1.70390463])

rr   	r   r   r   r   r   r   r   r   r   stanhr   r   r   )scale_ascale_br   )r   )	r-   r   r   r&   r)   r   r   r   r   )rr   r   r   r   r   r   s         rt   r   r   9  s    J ||A00 
 	
" 1177agg7F8CL%:	 	 	
 
rv   c                &   [        5       (       a  [        R                  " X5      $ [        5       (       a&  [	        USSS/S5        [        R                  " X5      $ [        S0 [        5       D6n[        U S[        S5        [        U 5      S:  a  [        S5      e[        U 5       H$  u  pE[	        US[        U5      -   S	-   / S
QS5        M&     [	        USSS/S5        UR                  U S   R                  5      nUR                  SXS.SU/0S9  U$ )aJ	  

Based on the given index parameter, the OP selects a specific row from each input Tensor to construct the output Tensor.

If the input of this OP contains :math:`m` Tensors, where :math:`I_{i}` means the i-th input Tensor, :math:`i` between :math:`[0,m)` .

And :math:`O` means the output, where :math:`O[i]` means the i-th row of the output, then the output satisfies that :math:`O[i] = I_{index[i]}[i]` .

For Example:

        .. code-block:: text

            Given:

            inputs = [[[0,0,3,4], [0,1,3,4], [0,2,4,4], [0,3,3,4]],
                      [[1,0,3,4], [1,1,7,8], [1,2,4,2], [1,3,3,4]],
                      [[2,0,3,4], [2,1,7,8], [2,2,4,2], [2,3,3,4]],
                      [[3,0,3,4], [3,1,7,8], [3,2,4,2], [3,3,3,4]]]

            index = [[3],[0],[1],[2]]

            out = [[3,0,3,4],    # out[0] = inputs[index[0]][0] = inputs[3][0] = [3,0,3,4]
                   [0,1,3,4],    # out[1] = inputs[index[1]][1] = inputs[0][1] = [0,1,3,4]
                   [1,2,4,2],    # out[2] = inputs[index[2]][2] = inputs[1][2] = [1,2,4,2]
                   [2,3,3,4]]    # out[3] = inputs[index[3]][3] = inputs[2][3] = [2,3,3,4]


Args:
    inputs (list[Tensor]|tuple[Tensor, ...]): The input Tensor list. The list elements are N-D Tensors of data types float32, float64, int32, int64, complex64, complex128. All input Tensor shapes should be the same and rank must be at least 2.
    index (Tensor): Used to select some rows in the input Tensor to construct an index of the output Tensor. It is a 2-D Tensor with data type int32 or int64 and shape [M, 1], where M is the number of input Tensors.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: Output of multiplex OP, with data type being float32, float64, int32, int64.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> img1 = paddle.to_tensor([[1, 2], [3, 4]], dtype=paddle.float32)
        >>> img2 = paddle.to_tensor([[5, 6], [7, 8]], dtype=paddle.float32)
        >>> inputs = [img1, img2]
        >>> index = paddle.to_tensor([[1], [0]], dtype=paddle.int32)
        >>> res = paddle.multiplex(inputs, index)
        >>> print(res)
        Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[5., 6.],
         [3., 4.]])

indexr   r   	multiplexr   r#   z8inputs should be a list object with at least 2 elements.zinput[])r   r   r   r   r   r   r   )r   Idsr   rm   r   r   )r   )r,   r   r   r.   r&   r)   r   r%   rh   rn   
ValueError	enumeratestrr   r   r   )r   r   r   r   idrr   r   s          rt   r   r   }  s   n ..	 7Wg.	
 ..5FH568d[9v;?J  v&EB$3r7"S(  ' 	!7Wg.	
 77q	H.SEN 	 	

 
rv   c                d    [        5       (       a!  [        R                  " X[        U5      U5      $ g)z
Inplace version of ``scale`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_scale`.
N)r,   r   scale_r   )rr   r   r   r   r   r   s         rt   r   r     s*     }}QuT{4DEE rv   inputexponentrr   yr   r   c               &   [        5       (       a  [        U[        [        45      (       a  [        R
                  " XUS9$ [        U[        R                  [        [        R                  R                  45      (       a  [        R                  " XUS9$ [        S[        U5       35      e[        U[        [        45      (       aJ  [        S
0 [        5       D6nSU 0nSU0nUR!                  U R"                  S9nUR%                  SUSU0US9  U$ [        U[        R                  [        45      (       aH  [        S0 [        5       D6nUR!                  U R"                  S9n['        [        S0 [        5       D65      $ [        S	[        U5       35      e)a  
Compute the power of Tensor elements. The equation is:

.. math::
    out = x^{y}

Note:
    ``paddle.pow`` supports broadcasting. If you want know more about broadcasting, please refer to `Introduction to Tensor`_ .

    .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

.. note::
        Alias Support: The parameter name ``input`` can be used as an alias for ``x``, The parameter name ``exponent`` can be used as an alias for ``y``.
        For example, ``pow(input=2, exponent=1.1)`` is equivalent to ``pow(x=2, y=1.1)``.

Args:
    x (Tensor): An N-D Tensor, the data type is bfloat16, float16, float32, float64, int32, int64, complex64 or complex128.
    input: An alias for ``x`` , with identical behavior.
    y (float|int|Tensor): If it is an N-D Tensor, its data type should be the same as `x`.
    exponent: An alias for ``y`` , with identical behavior.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
    out (Tensor, optional): The output tensor. If set, the result will be stored in this tensor. Default is None.

Returns:
    N-D Tensor. A location into which the result is stored. Its dimension and data type are the same as `x`.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([1, 2, 3], dtype='float32')

        >>> # example 1: y is a float or int
        >>> res = paddle.pow(x, 2)
        >>> print(res)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [1., 4., 9.])
        >>> res = paddle.pow(x, 2.5)
        >>> print(res)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [1.         , 5.65685415 , 15.58845711])

        >>> # example 2: y is a Tensor
        >>> y = paddle.to_tensor([2], dtype='float32')
        >>> res = paddle.pow(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [1., 4., 9.])

r   zLy must be scalar, Tensor(in dygraph mode), Value(in pir mode) but received: powr   factorr   r   r   z/y must be scalar or tensor type, but received: )r   )elementwise_pow)r-   rg   rk   r   r   r   rx   rc   r(   ry   r   r   rl   rm   r)   r   r   r   r   _elementwise_op)rr   r   r   r   r   r   r   s          rt   r   r     sb   | a#u&&::a,,FMM8VZZ5E5EFGG))!C88^_cde_f^gh 
 a#u&& 3&(3F1XFqME;;!'';JC6E3<u   JFMM8455 ?fh?F;;!'';JC";#MFH#MNNA$q'K rv   c                    [        U[        [        45      (       a  [        R                  " X5      $ [        S[        U5       S35      e)z}
Inplace version of ``pow`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_pow`.
z%y must be scalar type, but received:  )rg   rk   r   r   pow_rl   rm   rr   r   r   s      rt   r   r   L  s=     !c5\""{{1  ?QyJKKrv   r   r   r   floor_divideaddsubtractr   divide	remainder)	elementwise_maxelementwise_minr   elementwise_floordivelementwise_addelementwise_subelementwise_mulelementwise_divelementwise_modc                   U R                   nU R                  R                  SU5      nU R                  R                  SS 5      nU R                  R                  SS 5      nU R                  R                  SS 5      nUc
   SU 35       eUc
   SU 35       e/ SQnX&;   a  / SQnO/ S	Qn[        USUU5        [        USUU5        U R                  R                  S
S5      nU R                  R                  SS 5      n	Uc7  U	c  U R	                  UR
                  S9nOU R                  XR
                  SS9nU R                  UX4S.SU0S
U0S9  U R                  U5      $ )Noriginal_op_typerr   r   r   zx cannot be None in zy cannot be None in )r   r   r   r   r   r   )	r   r   r   r   r   r   boolr   r   )r   r   r   r   r   r   r   rq   r   r   F)r   r   persistabler   Yr   r   )	
layer_typekwargsgetr&   r   r   create_variabler   r   )
r   op_typer   rr   r   r   bf16_and_complex_supported_ops	data_typerq   r   s
             rt   r   r   e  s   G}}(();WE#t$A#t$A
--

E4
(C=C01A0BCC==C01A0BCC=&" 9

	
	 		 		 ==VR(D==VT*D
{<;;!'';JC((e ) C tn	   ##C((rv   other)alphar   c               z   [        5       (       a!  US:w  a  X-  OUn[        R                  " XUS9$ [        S0 [	        5       D6nUS:w  a  UR                  UR                  5      OUnUS:w  a  UR                  SSU/0SU/0USS.S	9  UR                  U R                  5      nUR                  SXS
.SU0SS0S	9  U$ )aH  
Elementwise Add Operator.
Add two tensors element-wise.
The equation is:

..  math::

    Out=X+Y

$X$ the tensor of any dimension.
$Y$ the tensor whose dimensions must be less than or equal to the dimensions of $X$.

This operator is used in the following cases:

1. The shape of $Y$ is the same with $X$.
2. The shape of $Y$ is a continuous subsequence of $X$.


    For example:

    .. code-block:: text

        shape(X) = (2, 3, 4, 5), shape(Y) = (,)
        shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
        shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5), with axis=-1(default) or axis=2
        shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
        shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0
        shape(X) = (2, 3, 4, 5), shape(Y) = (2, 1), with axis=0

.. note::
    Alias Support: The parameter name ``input`` can be used as an alias for ``x``, and ``other`` can be used as an alias for ``y``.
    For example, ``add(input=tensor_x, other=tensor_y)`` is equivalent to ``add(x=tensor_x, y=tensor_y)``.

Args:
    x (Tensor): Tensor of any dimensions. Its dtype should be bool, bfloat16, float16, float32, float64,
        int8, int16, int32, int64, uint8, complex64, complex128.
        alias: ``input``.
    y (Tensor): Tensor of any dimensions. Its dtype should be bool, bfloat16, float16, float32, float64,
        int8, int16, int32, int64, uint8, complex64, complex128.
        alias: ``other``.
    alpha (Number, optional): Scaling factor for Y. Default: 1.
    out (Tensor, optional): The output tensor. Default: None.
    name (str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
    N-D Tensor. A location into which the result is stored. It's dimension equals with x.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([2, 3, 4], 'float64')
        >>> y = paddle.to_tensor([1, 5, 2], 'float64')
        >>> z = paddle.add(x, y)
        >>> print(z)
        Tensor(shape=[3], dtype=float64, place=Place(cpu), stop_gradient=True,
        [3., 8., 6.])
r/   r   r   r   r   r           r   r   r   r   rq   r   )r   )r-   r   r   r)   r   r   r   r   rr   r   r   r   r   scaled_yr   outputs           rt   r   r     s    J  %
19zz!3//;&(; z 55agg> 	 A:aSz
+ %s3	   ::177C"*FO2,	 	 	
 rv   )r   c                   [        U R                  UR                  5      nX@R                  :w  a  [        SU SU R                   S35      eUS:w  a  X-  OUn[        R                  " X5      $ )z}
Inplace version of ``add`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_add`.
The shape of broadcast output * is different from that of inplace tensor  in the Inplace operation.r/   )broadcast_shapero   r   r   add_rr   r   r   r   	out_shaper   s         rt   r   r     sr      1IGG,YK7abcbibiaj  kE  F
 	
 "QJqyAH;;q##rv   c                f   [         R                  " [         R                  " [         R                  " X-
  5      * 5      5      n[         R                  " X5      nUR
                  [         R                  :X  d  UR
                  [         R                  :X  a  UR                  UR
                  5      nX4-   $ )a  
Elementwise LogAddExp Operator.
Add of exponentiations of the inputs
The equation is:

..  math::

    Out=log(X.exp()+Y.exp())

$X$ the tensor of any dimension.
$Y$ the tensor whose dimensions must be less than or equal to the dimensions of $X$.

There are two cases for this operator:

1. The shape of $Y$ is the same with $X$.
2. The shape of $Y$ is a continuous subsequence of $X$.

For case 2:

1. Broadcast $Y$ to match the shape of $X$, where axis is the start dimension index for broadcasting $Y$ onto $X$.
2. If $axis$ is -1 (default), $axis$=rank($X$)-rank($Y$).
3. The trailing dimensions of size 1 for $Y$ will be ignored for the consideration of subsequence, such as shape($Y$) = (2, 1) => (2).

    For example:

    .. code-block:: text

        shape(X) = (2, 3, 4, 5), shape(Y) = (,)
        shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
        shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5), with axis=-1(default) or axis=2
        shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
        shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0
        shape(X) = (2, 3, 4, 5), shape(Y) = (2, 1), with axis=0

Args:
    x (Tensor): Tensor of any dimensions. Its dtype should be int32, int64, bfloat16, float16, float32, float64.
    y (Tensor): Tensor of any dimensions. Its dtype should be int32, int64, bfloat16, float16, float32, float64.
    name (str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
    N-D Tensor. A location into which the result is stored. It's dimension equals with x.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([-1, -2, -3], 'float64')
        >>> y = paddle.to_tensor([-1], 'float64')
        >>> z = paddle.logaddexp(x, y)
        >>> print(z)
        Tensor(shape=[3], dtype=float64, place=Place(cpu), stop_gradient=True,
        [-0.30685282, -0.68673831, -0.87307199])
)	rx   r   rJ   r4   r   r   r   r   astype)rr   r   r   log_1p_maximums        rt   	logaddexpr   (  sr    p \\&**fjj&7%789F~~a#H~~%6<<)G??6<<0rv   c               z   [        5       (       a!  US:w  a  X-  OUn[        R                  " XUS9$ [        S0 [	        5       D6nUS:w  a  UR                  UR                  5      OUnUS:w  a  UR                  SSU/0SU/0USS.S	9  UR                  U R                  5      nUR                  SXS
.SU0SS0S	9  U$ )au	  
Subtract two tensors element-wise. The equation is:

.. math::
    out = x - y

Note:
    ``paddle.subtract`` supports broadcasting. If you want know more about broadcasting, please refer to `Introduction to Tensor`_ .

    .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

Args:
    x (Tensor): the input tensor, it's data type should be bfloat16, float16, float32, float64, int16, int32, int64, complex64, complex128.
    y (Tensor): the input tensor, it's data type should be bfloat16, float16, float32, float64, int16, int32, int64, complex64, complex128.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
    alpha (Number, optional): Scaling factor for Y. Default: 1.
    out (Tensor, optional): The output tensor. Default: None.

Returns:
    N-D Tensor. A location into which the result is stored. If x, y have different shapes and are "broadcastable", the resulting tensor shape is the shape of x and y after broadcasting. If x, y have the same shape,  its shape is the same as x and y.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([[1, 2], [7, 8]])
        >>> y = paddle.to_tensor([[5, 6], [3, 4]])
        >>> res = paddle.subtract(x, y)
        >>> print(res)
        Tensor(shape=[2, 2], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[-4, -4],
         [ 4,  4]])

        >>> x = paddle.to_tensor([[[1, 2, 3], [1, 2, 3]]])
        >>> y = paddle.to_tensor([1, 0, 4])
        >>> res = paddle.subtract(x, y)
        >>> print(res)
        Tensor(shape=[1, 2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[[ 0,  2, -1],
          [ 0,  2, -1]]])

        >>> x = paddle.to_tensor([2, float('nan'), 5], dtype='float32')
        >>> y = paddle.to_tensor([1, 4, float('nan')], dtype='float32')
        >>> res = paddle.subtract(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [1. , nan, nan])

        >>> x = paddle.to_tensor([5, float('inf'), -float('inf')], dtype='float64')
        >>> y = paddle.to_tensor([1, 4, 5], dtype='float64')
        >>> res = paddle.subtract(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=float64, place=Place(cpu), stop_gradient=True,
        [ 4.  ,  inf., -inf.])
r/   r   r   r   r   r   r   r   r   r   rq   r   r   )r-   r   r   r)   r   r   r   r   r   s           rt   r   r   g  s    D  %
19q44;&(; z 55agg> 	 A:aSz
+ %s3	   ::177C"*FO2,	 	 	
 rv   c                   [        U R                  UR                  5      nX@R                  :w  a  [        SU SU R                   S35      eUS:w  a  X-  OUn[        R                  " X5      $ )z
Inplace version of ``subtract`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_subtract`.
r   r   r   r/   )r   ro   r   r   	subtract_r   s         rt   r   r     st      1IGG,YK7abcbibiaj  kE  F
 	
 "QJqyAHA((rv   )rounding_moder   c                  UcD  [        5       (       a  [        R                  " XUS9nU$ [        [	        S0 [        5       D65      nU$ US:X  a  [        5       (       a  [        R                  " XUS9nU$ [        [	        S0 [        5       D65      nSU0n0 n[	        S0 [        5       D6n	[        US/ SQS5        U	R                  UR                  S9nU	R                  SXxSU0S9  U$ US:X  aD  [        5       (       a  [        R                  " XUS9nU$ [        [	        S0 [        5       D65      nU$ S	U S
3n
[        U
5      e)a  
Divide two tensors element-wise. The equation is:

.. math::
    out = x / y

Note:
    ``paddle.divide`` supports broadcasting. If you want know more about broadcasting, please refer to `Introduction to Tensor`_ .

    .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

.. note::
    Alias Support: The parameter name ``input`` can be used as an alias for ``x``, and ``other`` can be used as an alias for ``y``.
    For example, ``divide(input=tensor_x, other=tensor_y)`` is equivalent to ``divide(x=tensor_x, y=tensor_y)``.

Args:
    x (Tensor): the input tensor, it's data type should be bool, bfloat16, float16, float32, float64,
        int8, int16, int32, int64, uint8, complex64, complex128.
        alias: ``input``.
    y (Tensor): the input tensor, it's data type should be bool, bfloat16, float16, float32, float64,
        int8, int16, int32, int64, uint8, complex64, complex128.
        alias: ``other``.
    rounding_mode (str|None, optional): The rounding mode. Can be None (default), "trunc" (truncate toward zero), or "floor" (round down toward negative infinity).
    out (Tensor, optional): The output tensor. Default: None.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    N-D Tensor. A location into which the result is stored. If x, y have different shapes and are "broadcastable", the resulting tensor shape is the shape of x and y after broadcasting. If x, y have the same shape,  its shape is the same as x and y.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([2, 3, 4], dtype='float64')
        >>> y = paddle.to_tensor([1, 5, 2], dtype='float64')
        >>> z = paddle.divide(x, y)
        >>> print(z)
        Tensor(shape=[3], dtype=float64, place=Place(cpu), stop_gradient=True,
        [2.        , 0.60000000, 2.        ])

r   truncr   r   r   r   r   r   r   rm   r   r   r   rN   zLdiv expected rounding_mode to be one of None, 'trunc', or 'floor' but found .)r   r   r   )r-   r   r   r   r)   r   trunc_divider&   r   r   r   r   r   )rr   r   r   r   r   restmpr   r   r   msgs              rt   r   r     sX   h !##--#.C 
 "+"L68"LMC
	'	!!##%%a4C 
 "+"L68"LMC3ZFE 5FH5F$SBG ;;#));LCV5#,   
	'	!!##%%a4C 
	 "?fh?C 
\]j\kklmorv   )r   c               h   [        U R                  UR                  5      nX@R                  :w  a  [        SU SU R                   S35      eUc  [        R                  " X5      nU$ US:X  a  [        R
                  " X5      nU$ US:X  a  [        R                  " X5      nU$ SU S3n[        U5      e)z
Inplace version of ``divide`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_divide`.
r   r   r   r   rN   zMdiv_ expected rounding_mode to be one of None, 'trunc', or 'floor' but found r   )r   ro   r   r   divide_trunc_divide_floor_divide_)rr   r   r   r   r   r  r  s          rt   r  r  9  s      1IGG,YK7abcbibiaj  kE  F
 	
 nnQ" J 
'	!""1( J 
'	!""1(
 J ^^k]llmnorv   c                   [        XUS9$ )z\
Alias for paddle.divide with rounding_mode=None.
Please refer to :ref:`api_paddle_divide`.
r   )r   )r   r   r   s      rt   true_divider  Y  s     %C((rv   c                  [        5       (       a^  [        U[        R                  5      (       a*  [        R
                  " U [        R                  " U5      US9$ [        R
                  " XUS9$ [        [        S0 [        5       D65      $ )u  
Floor divide two tensors element-wise and rounds the quotinents to the nearest integer toward negative infinite. The equation is:

.. math::
    out = floor(x / y)

- :math:`x`: Multidimensional Tensor.
- :math:`y`: Multidimensional Tensor.

Note:
    ``paddle.floor_divide`` supports broadcasting. If you want know more about broadcasting, please refer to `Introduction to Tensor`_ .

    .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor


Args:
    x (Tensor): the input tensor, it's data type should be uint8, int8, int32, int64, float32, float64, float16, bfloat16.
        alias: ``input``.
    y (Tensor｜Number): the input tensor or number, it's data type should be uint8, int8, int32, int64, float32, float64, float16, bfloat16.
        alias: ``other``.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
    out (Tensor|None, optional): The output tensor. Default: None.

Returns:
    N-D Tensor. A location into which the result is stored. It's dimension equals with $x$.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([2, 3, 8, 7])
        >>> y = paddle.to_tensor([1, 5, 3, 3])
        >>> z = paddle.floor_divide(x, y)
        >>> print(z)
        Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [2, 0, 2, 2])

        >>> x = paddle.to_tensor([2, 3, 8, 7])
        >>> y = paddle.to_tensor([1, -5, -3, -3])
        >>> z = paddle.floor_divide(x, y)
        >>> print(z)
        Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [2, -1, -3, -3])
r   r  )r-   rg   numbersrb   r   r   rx   	to_tensorr   r)   r   rr   r   r   r   s       rt   r   r   f  sg    l a((&&q&*:*:1*=3GG""1S11{NVXNOOrv   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        R                  " X5      $ )z
Inplace version of ``floor_divide`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_floor_divide`.
r   r   r   )r   ro   r   r   r	  rr   r   r   r   s       rt   r	  r	    se      1IGG,YK7abcbibiaj  kE  F
 	
 %%rv   c                   [        5       (       aO  [        U[        [        45      (       a  [        R
                  " / XR                  S9n[        R                  " XUS9$ [        [        S0 [        5       D65      $ )ay  
Mod two tensors element-wise. The equation is:

.. math::

    out = x \% y

.. note::
    Alias Support: The parameter name ``input`` can be used as an alias for ``x``, and ``other`` can be used as an alias for ``y``.

Note:
    ``paddle.remainder`` supports broadcasting. If you want know more about broadcasting, please refer to `Introduction to Tensor`_ .

    .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

    And `mod`, `floor_mod` are all functions with the same name

Args:
    x (Tensor): the input tensor, it's data type should be bfloat16, float16, float32, float64, int32, int64.
    y (Tensor): the input tensor, it's data type should be bfloat16, float16, float32, float64, int32, int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
    out (Tensor|None, optional): The output tensor. If set, the result will be stored in this tensor. Default is None.

Returns:
    N-D Tensor. A location into which the result is stored. If x, y have different shapes and are "broadcastable", the resulting tensor shape is the shape of x and y after broadcasting. If x, y have the same shape,  its shape is the same as x and y.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([2, 3, 8, 7])
        >>> y = paddle.to_tensor([1, 5, 3, 3])
        >>> z = paddle.remainder(x, y)
        >>> print(z)
        Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [0, 3, 2, 1])

        >>> z = paddle.floor_mod(x, y)
        >>> print(z)
        Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [0, 3, 2, 1])

        >>> z = paddle.mod(x, y)
        >>> print(z)
        Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [0, 3, 2, 1])

r   r   )r   )r-   rg   rk   r   rx   fullr   r   r   r   r)   r   r  s       rt   r   r     s[    l a#u&&B1A#..{IIJJrv   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        R                  " X5      $ )z
Inplace version of ``remainder`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_remainder`.
r   r   r   )r   ro   r   r   
remainder_r  s       rt   r  r    se      1IGG,YK7abcbibiaj  kE  F
 	
 Q""rv   z
    Inplace version of ``mod`` API, the output Tensor will be inplaced with input ``x``.
    Please refer to :ref:`api_paddle_mod`.
    z
    Inplace version of ``floor_mod_`` API, the output Tensor will be inplaced with input ``x``.
    Please refer to :ref:`api_paddle_floor_mod_`.
    c                   [        5       (       a  [        R                  " XUS9$ [        [	        S0 [        5       D65      $ )a  
multiply two tensors element-wise. The equation is:

.. math::
    out = x * y

Note:
    Supported shape of :attr:`x` and :attr:`y` for this operator:
    1. `x.shape` == `y.shape`.
    2. `x.shape` could be the continuous subsequence of `y.shape`.
    ``paddle.mul`` supports broadcasting. If you would like to know more about broadcasting, please refer to `Introduction to Tensor`_ .

    .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

Args:
    x (Tensor): the input tensor, its data type should be one of bfloat16, float16, float32, float64, int32, int64, bool, complex64, complex128.
    y (Tensor): the input tensor, its data type should be one of bfloat16, float16, float32, float64, int32, int64, bool, complex64, complex128.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
    out (Tensor|None, optional): The output tensor. If set, the result will be stored in this tensor. Default is None.

Returns:
    N-D Tensor. A location into which the result is stored. If :attr:`x`, :attr:`y` have different shapes and are "broadcastable", the resulting tensor shape is the shape of :attr:`x` and :attr:`y` after broadcasting. If :attr:`x`, :attr:`y` have the same shape, its shape is the same as :attr:`x` and :attr:`y`.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([[1, 2], [3, 4]])
        >>> y = paddle.to_tensor([[5, 6], [7, 8]])
        >>> res = paddle.mul(x, y)
        >>> print(res)
        Tensor(shape=[2, 2], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[5 , 12],
         [21, 32]])
        >>> x = paddle.to_tensor([[[1, 2, 3], [1, 2, 3]]])
        >>> y = paddle.to_tensor([2])
        >>> res = paddle.mul(x, y)
        >>> print(res)
        Tensor(shape=[1, 2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[[2, 4, 6],
          [2, 4, 6]]])

r   )r   )r-   r   r   r   r)   r   r  s       rt   mulr    s4    b q--{IIJJrv   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        R                  " X5      $ )z
Inplace version of ``multiply`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_multiply`.
r   r   r   )r   ro   r   r   	multiply_r  s       rt   r  r  C  se      1IGG,YK7abcbibiaj  kE  F
 	
 A!!rv   c                N   [        5       (       d   S5       eUS;   d   SU S35       e[        [        U5      n[        U R                  5      n[        UR                  5      nUS:X  d  [        U5      [        U5      :X  a  U" X5      $ [        U5      [        U5      :  a@  [        U5      [        U5      -
  U-
  n[        R                  " US/U-  U-   S/U-  -   5      nO?[        U5      [        U5      -
  U-
  n[        R                  " U S/U-  U-   S/U-  -   5      n U" X5      $ )NzTYou can only call `_elementwise_op_with_axis` function within in_dynamic_or_pir_mode)r   r   r   r   zzop_name input error! _elementwise_op_with_axis is an inner function to replace elementwise_add/sub/mul/div. Input op_name=z0, Expect op_name=[add|subtract|multiply|divide]
r   r/   )r-   getattrr   rh   ro   rn   rx   reshape)	rr   r   rq   r   r   opx_shapey_shapepaddings	            rt   _elementwise_op_with_axisr!  T  s4   !## ^#     E  FM  EN  N  	@  
	!B177mG177mGrzS\S\1!x
7|c'l"g,W-4NN1qcDj72aS7]BCg,W-4NN1qcDj72aS7]BCa8Orv   c                x    [        5       (       a  [        XX#S5      $ Sn[        [        U40 [	        5       D65      $ )Nr   r   r-   r!  r   r)   r   rr   r   rq   r   r   s        rt   _add_with_axisr%  n  s6    (t5AA#{7?fh?@@rv   c                x    [        5       (       a  [        XX#S5      $ Sn[        [        U40 [	        5       D65      $ )Nr   r   r#  r$  s        rt   _subtract_with_axisr'  w  6    (t:FF#{7?fh?@@rv   c                x    [        5       (       a  [        XX#S5      $ Sn[        [        U40 [	        5       D65      $ )Nr   r   r#  r$  s        rt   _multiply_with_axisr*    r(  rv   c                x    [        5       (       a  [        XX#S5      $ Sn[        [        U40 [	        5       D65      $ )Nr   r   r#  r$  s        rt   _divide_with_axisr,    s6    (t8DD#{7?fh?@@rv   c                    [        5       (       a  [        R                  " X5      $ [        [	        S0 [        5       D65      $ )a	  
Compares the elements at the corresponding positions of the two tensors and returns a new tensor containing the maximum value of the element.
If one of them is a nan value, the other value is directly returned, if both are nan values, then the first nan value is returned.
The equation is:

.. math::
    out = fmax(x, y)

Note:
    ``paddle.fmax`` supports broadcasting. If you want know more about broadcasting, please refer to `Introduction to Tensor`_ .

    .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

Args:
    x (Tensor): the input tensor, it's data type should be bfloat16, float16, float32, float64, int32, int64.
    y (Tensor): the input tensor, it's data type should be bfloat16, float16, float32, float64, int32, int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    N-D Tensor. A location into which the result is stored. If x, y have different shapes and are "broadcastable", the resulting tensor shape is the shape of x and y after broadcasting. If x, y have the same shape,  its shape is the same as x and y.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([[1, 2], [7, 8]])
        >>> y = paddle.to_tensor([[3, 4], [5, 6]])
        >>> res = paddle.fmax(x, y)
        >>> print(res)
        Tensor(shape=[2, 2], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[3, 4],
         [7, 8]])

        >>> x = paddle.to_tensor([[1, 2, 3], [1, 2, 3]])
        >>> y = paddle.to_tensor([3, 0, 4])
        >>> res = paddle.fmax(x, y)
        >>> print(res)
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[3, 2, 4],
         [3, 2, 4]])

        >>> x = paddle.to_tensor([2, 3, 5], dtype='float32')
        >>> y = paddle.to_tensor([1, float("nan"), float("nan")], dtype='float32')
        >>> res = paddle.fmax(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [2., 3., 5.])

        >>> x = paddle.to_tensor([5, 3, float("inf")], dtype='float32')
        >>> y = paddle.to_tensor([1, -float("inf"), 5], dtype='float32')
        >>> res = paddle.fmax(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [5.  , 3.  , inf.])
)elementwise_fmax)r-   r   fmaxr   r)   r   r   s      rt   r/  r/    2    t {{1  {JJKKrv   c                    [        5       (       a  [        R                  " X5      $ [        [	        S0 [        5       D65      $ )a	  
Compares the elements at the corresponding positions of the two tensors and returns a new tensor containing the minimum value of the element.
If one of them is a nan value, the other value is directly returned, if both are nan values, then the first nan value is returned.
The equation is:

.. math::
    out = fmin(x, y)

Note:
    ``paddle.fmin`` supports broadcasting. If you want know more about broadcasting, please refer to `Introduction to Tensor`_ .

    .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

Args:
    x (Tensor): the input tensor, it's data type should be bfloat16, float16, float32, float64, int32, int64.
    y (Tensor): the input tensor, it's data type should be bfloat16, float16, float32, float64, int32, int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    N-D Tensor. A location into which the result is stored. If x, y have different shapes and are "broadcastable", the resulting tensor shape is the shape of x and y after broadcasting. If x, y have the same shape,  its shape is the same as x and y.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([[1, 2], [7, 8]])
        >>> y = paddle.to_tensor([[3, 4], [5, 6]])
        >>> res = paddle.fmin(x, y)
        >>> print(res)
        Tensor(shape=[2, 2], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[1, 2],
         [5, 6]])

        >>> x = paddle.to_tensor([[[1, 2, 3], [1, 2, 3]]])
        >>> y = paddle.to_tensor([3, 0, 4])
        >>> res = paddle.fmin(x, y)
        >>> print(res)
        Tensor(shape=[1, 2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[[1, 0, 3],
          [1, 0, 3]]])

        >>> x = paddle.to_tensor([2, 3, 5], dtype='float32')
        >>> y = paddle.to_tensor([1, float("nan"), float("nan")], dtype='float32')
        >>> res = paddle.fmin(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [1., 3., 5.])

        >>> x = paddle.to_tensor([5, 3, float("inf")], dtype='float64')
        >>> y = paddle.to_tensor([1, -float("inf"), 5], dtype='float64')
        >>> res = paddle.fmin(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=float64, place=Place(cpu), stop_gradient=True,
        [ 1.  , -inf.,  5.  ])
)elementwise_fmin)r-   r   fminr   r)   r   r   s      rt   r3  r3    r0  rv   c                   [        5       (       a  [        R                  " X5      $ [        U S/ SQS5        [        US/ SQS5        [	        S	0 [        5       D6nUR                  U R                  S9nUR                  SXS.SU0S9  U$ )
a  
Computes the sum of tensor elements make the shape of its result equal to the shape of target.

Args:
    x (Tensor): An N-D Tensor, the data type is bool, float16, float32, float64, int8, uint8, int16, uint16, int32, int64, complex64 or complex128.
    target (Tensor): An N-D Tensor, the length of x shape must greater than or equal to the length of target shape. The data type is bool, float16, float32, float64, int8, uint8, int16, uint16, int32, int64, complex64 or complex128.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: The sum of the input tensor x along some axis has the same shape as the shape of the input tensor target, if `x.dtype='bool'`, `x.dtype='int32'`, it's data type is `'int64'`, otherwise it's data type is the same as `x`.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([[1, 2, 3, 4], [5, 6, 7, 8]])
        >>> x
        Tensor(shape=[2, 4], dtype=int64, place=Place(gpu:0), stop_gradient=True,
        [[1, 2, 3, 4],
         [5, 6, 7, 8]])
        >>> target = paddle.to_tensor([1, 2, 3, 4])
        >>> target
        Tensor(shape=[4], dtype=int64, place=Place(gpu:0), stop_gradient=True,
        [1, 2, 3, 4])
        >>> res = paddle.reduce_as(x, target)
        >>> res
        Tensor(shape=[4], dtype=int64, place=Place(gpu:0), stop_gradient=True,
        [6 , 8 , 10, 12])
rr   )r   r   r   r   r   r   r   r   r   r   r   r   	reduce_astargetr   )rr   r6  r   r   )r5  )	r-   r   r5  r&   r)   r   r   r   r   )rr   r6  r   r   r   s        rt   r5  r5    s    @ **  #	
& 	! #	
( 5FH577agg7F-CL 	 	

 
rv   c                v   [         R                  " U [        S5      5      n[         R                  " U [        S5      5      n[         R                  " X5      nU R                  [         R                  [         R
                  [         R                  R                  R                  R                  [         R                  R                  R                  R                  4;   d   eU R                  [         R                  :H  =(       d;    U R                  [         R                  R                  R                  R                  :H  nUcc  U(       a.  [        R                  " [        R                  5      R                  O-[        R                  " [        R
                  5      R                  n[         R                  " X5      nUcc  U(       a.  [        R                  " [        R                  5      R                  O-[        R                  " [        R
                  5      R                  n[         R                  " X5      n[         R                  " [         R                   " U 5      X5      n [         R                  " [         R"                  " X5      X 5      n [         R                  " [         R"                  " X5      X05      n U $ )u	  
Replaces NaN, positive infinity, and negative infinity values in input tensor.

Args:
    x (Tensor): An N-D Tensor, the data type is float32, float64.
    nan (float, optional): the value to replace NaNs with. Default is 0.
    posinf (float|None, optional): if a Number, the value to replace positive infinity values with. If None, positive infinity values are replaced with the greatest finite value representable by input’s dtype. Default is None.
    neginf (float|None, optional): if a Number, the value to replace negative infinity values with. If None, negative infinity values are replaced with the lowest finite value representable by input’s dtype. Default is None.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: Results of nan_to_num operation input Tensor ``x``.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([float('nan'), 0.3, float('+inf'), float('-inf')], dtype='float32')
        >>> out1 = paddle.nan_to_num(x)
        >>> out1
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [ 0.                                      ,
          0.30000001                              ,
          340282346638528859811704183484516925440.,
         -340282346638528859811704183484516925440.])
        >>> out2 = paddle.nan_to_num(x, nan=1)
        >>> out2
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [ 1.                                      ,
          0.30000001                              ,
          340282346638528859811704183484516925440.,
         -340282346638528859811704183484516925440.])
        >>> out3 = paddle.nan_to_num(x, posinf=5)
        >>> out3
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [ 0.                                      ,
          0.30000001                              ,
          5.                                      ,
         -340282346638528859811704183484516925440.])
        >>> out4 = paddle.nan_to_num(x, nan=10, neginf=-99)
        >>> out4
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [ 10.                                    ,
          0.30000001                             ,
         340282346638528859811704183484516925440.,
         -99.                                    ])
+inf-inf)rx   	full_liker   r   r   r   baser+   r   FLOAT32FLOAT64npfinfomaxminwherer   equal)rr   nanposinfneginfr   posinf_valueneginf_value
is_float32s           rt   
nan_to_numrJ  f  s   r ##AuV}5L##AuV}5L


1
"C77!!))!!))	    	
6>>! 	877fkk&&//777  ~(2BHHRZZ $$8L8P8P 	 a(F~(2BHHRZZ $$8L8P8P 	 a(FV\\!_c-AV\\!2F>AV\\!2F>AHrv   c                "   [         R                  " U [        S5      5      n[         R                  " U [        S5      5      n[         R                  " X5      nU R                  [         R                  [         R
                  4;   d   eU R                  [         R                  :H  nUcc  U(       a.  [        R                  " [        R                  5      R                  O-[        R                  " [        R
                  5      R                  n[         R                  " X5      nUcc  U(       a.  [        R                  " [        R                  5      R                  O-[        R                  " [        R
                  5      R                  n[         R                  " X5      n[         R                  " [         R                  " U 5      5      n[         R                  " XU5      n [         R                  " X:g  X5      n [         R                  " X:g  X5      n U $ )z
Inplace version of ``nan_to_num`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_nan_to_num`.
r8  r9  )rx   r:  r   r   r   r   r>  r?  r@  rA  logical_notr   where_)	rr   rD  rE  rF  r   rG  rH  rI  	x_not_nans	            rt   nan_to_num_rO    sV    ##AuV}5L##AuV}5L


1
"C77v~~v~~6666FNN*J~(2BHHRZZ $$8L8P8P 	 a(F~(2BHHRZZ $$8L8P8P 	 a(F""6<<?3IiC(Aa'3Aa'3AHrv   rq   c           
         [        U S/ SQS5        [        US[        [        [        [        S5      4S5        [        R                  " U 5      n[        R                  " [        U 5      XP5      n[        XaX#U5      $ )a  
Computes the sum of tensor elements over the given axis, treating Not a Numbers (NaNs) as zero.

Args:
    x (Tensor): An N-D Tensor, the data type is bfloat16, float16, float32, float64, int32 or int64.
    axis (int|list|tuple, optional): The dimensions along which the nansum is performed. If
        :attr:`None`, nansum all elements of :attr:`x` and return a
        Tensor with a single element, otherwise must be in the
        range :math:`[-rank(x), rank(x))`. If :math:`axis[i] < 0`,
        the dimension to reduce is :math:`rank + axis[i]`.
    dtype (str|paddle.dtype|np.dtype, optional): The dtype of output Tensor. The default value is None, the dtype
        of output is the same as input Tensor `x`.
    keepdim (bool, optional): Whether to reserve the reduced dimension in the
        output Tensor. The result Tensor will have one fewer dimension
        than the :attr:`x` unless :attr:`keepdim` is true, default
        value is False.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: Results of summation operation on the specified axis of input Tensor `x`,

Examples:
    .. code-block:: python

        >>> import paddle

        >>> # x is a Tensor with following elements:
        >>> #    [[nan, 0.3, 0.5, 0.9]
        >>> #     [0.1, 0.2, -nan, 0.7]]
        >>> # Each example is followed by the corresponding output tensor.
        >>> x = paddle.to_tensor([[float('nan'), 0.3, 0.5, 0.9],
        ...                       [0.1, 0.2, float('-nan'), 0.7]],dtype="float32")
        >>> out1 = paddle.nansum(x)
        >>> out1
        Tensor(shape=[], dtype=float32, place=Place(cpu), stop_gradient=True,
        2.69999981)
        >>> out2 = paddle.nansum(x, axis=0)
        >>> out2
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.10000000, 0.50000000, 0.50000000, 1.59999990])
        >>> out3 = paddle.nansum(x, axis=-1)
        >>> out3
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [1.70000005, 1.        ])
        >>> out4 = paddle.nansum(x, axis=1, keepdim=True)
        >>> out4
        Tensor(shape=[2, 1], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[1.70000005],
         [1.        ]])

        >>> # y is a Tensor with shape [2, 2, 2] and elements as below:
        >>> #      [[[1, nan], [3, 4]],
        >>> #       [[5, 6], [-nan, 8]]]
        >>> # Each example is followed by the corresponding output tensor.
        >>> y = paddle.to_tensor([[[1, float('nan')], [3, 4]],
        ...                       [[5, 6], [float('-nan'), 8]]])
        >>> out5 = paddle.nansum(y, axis=[1, 2])
        >>> out5
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [8. , 19.])
        >>> out6 = paddle.nansum(y, axis=[0, 1])
        >>> out6
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [9. , 18.])
rr   r   r   r   r   r   r   nansumrq   N)r&   r%   rk   rh   ri   rm   rx   
zeros_likerB  r   r   )rr   rq   r   keepdimr   zero_tensor
tmp_tensors          rt   rR  rR    si    P 	E	 tVc4T
;XF##A&KeAh7Jz66rv   c           	     l   [        U[        5      (       a  U/n[        U S/ SQS5        Ub  [        US[        [        [
        4S5        [        R                  " [        R                  " U 5      ) XS9n[        R                  " [        R                  " XX#S9UR                  U R                  5      5      $ )a  
Compute the arithmetic mean along the specified axis, ignoring NaNs.

Args:
    x (Tensor): The input Tensor with data type uint16, float16, float32, float64.
    axis (int|list|tuple, optional):The axis along which to perform nanmean
        calculations. ``axis`` should be int, list(int) or tuple(int). If
        ``axis`` is a list/tuple of dimension(s), nanmean is calculated along
        all element(s) of ``axis`` . ``axis`` or element(s) of ``axis``
        should be in range [-D, D), where D is the dimensions of ``x`` . If
        ``axis`` or element(s) of ``axis`` is less than 0, it works the
        same way as :math:`axis + D` . If ``axis`` is None, nanmean is
        calculated over all elements of ``x``. Default is None.
    keepdim (bool, optional): Whether to reserve the reduced dimension(s)
        in the output Tensor. If ``keepdim`` is True, the dimensions of
        the output Tensor is the same as ``x`` except in the reduced
        dimensions(it is of size 1 in this case). Otherwise, the shape of
        the output Tensor is squeezed in ``axis`` . Default is False.
    name (str|None, optional): Name for the operation (optional, default is None).
        For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, results of arithmetic mean along ``axis`` of ``x``, with the same data
    type as ``x``.

Examples:

    .. code-block:: python

        >>> import paddle
        >>> # x is a 2-D Tensor:
        >>> x = paddle.to_tensor([[float('nan'), 0.3, 0.5, 0.9],
        ...                       [0.1, 0.2, float('-nan'), 0.7]])
        >>> out1 = paddle.nanmean(x)
        >>> out1
        Tensor(shape=[], dtype=float32, place=Place(cpu), stop_gradient=True,
        0.44999996)
        >>> out2 = paddle.nanmean(x, axis=0)
        >>> out2
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.10000000, 0.25000000, 0.50000000, 0.79999995])
        >>> out3 = paddle.nanmean(x, axis=0, keepdim=True)
        >>> out3
        Tensor(shape=[1, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[0.10000000, 0.25000000, 0.50000000, 0.79999995]])
        >>> out4 = paddle.nanmean(x, axis=1)
        >>> out4
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.56666666, 0.33333334])
        >>> out5 = paddle.nanmean(x, axis=1, keepdim=True)
        >>> out5
        Tensor(shape=[2, 1], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[0.56666666],
         [0.33333334]])

        >>> # y is a 3-D Tensor:
        >>> y = paddle.to_tensor([[[1, float('nan')], [3, 4]],
        ...                       [[5, 6], [float('-nan'), 8]]])
        >>> out6 = paddle.nanmean(y, axis=[1, 2])
        >>> out6
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [2.66666675, 6.33333349])
        >>> out7 = paddle.nanmean(y, axis=[0, 1])
        >>> out7
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [3., 6.])
x/inputr   r   r   r   nanmeanzaxis/dim)rq   rT  rq   rT  r   )rg   rk   r&   r%   rh   ri   rx   r   r   r   rR  r   r   )rr   rq   rT  r   cnts        rt   rZ  rZ  5  s    R $v	9A9 4c4%7C
**fll1o%D
BC==aG?

177 rv   c                    [        U[        5      (       a  U/n[        R                  " U S5      n[        R                  " US5      n[        R                  " XQX#S9$ )a3
  
Counts the number of non-zero values in the tensor x along the specified axis.

Args:
    x (Tensor): An N-D Tensor, the data type is bool, float16, float32, float64, int32 or int64.
    axis (int|list|tuple, optional): The dimensions along which the sum is performed. If
        :attr:`None`, sum all elements of :attr:`x` and return a
        Tensor with a single element, otherwise must be in the
        range :math:`[-rank(x), rank(x))`. If :math:`axis[i] < 0`,
        the dimension to reduce is :math:`rank + axis[i]`.
    keepdim (bool, optional): Whether to reserve the reduced dimension in the
        output Tensor. The result Tensor will have one fewer dimension
        than the :attr:`x` unless :attr:`keepdim` is true, default
        value is False.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: Results of count operation on the specified axis of input Tensor `x`, it's data type is `'int64'`.

Examples:

    .. code-block:: python

        >>> import paddle
        >>> # x is a 2-D Tensor:
        >>> x = paddle.to_tensor([[0., 1.1, 1.2], [0., 0., 1.3], [0., 0., 0.]])
        >>> out1 = paddle.count_nonzero(x)
        >>> out1
        Tensor(shape=[], dtype=int64, place=Place(cpu), stop_gradient=True,
        3)
        >>> out2 = paddle.count_nonzero(x, axis=0)
        >>> out2
        Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [0, 1, 2])
        >>> out3 = paddle.count_nonzero(x, axis=0, keepdim=True)
        >>> out3
        Tensor(shape=[1, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[0, 1, 2]])
        >>> out4 = paddle.count_nonzero(x, axis=1)
        >>> out4
        Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [2, 1, 0])
        >>> out5 = paddle.count_nonzero(x, axis=1, keepdim=True)
        >>> out5
        Tensor(shape=[3, 1], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[2],
         [1],
         [0]])

        >>> # y is a 3-D Tensor:
        >>> y = paddle.to_tensor([[[0., 1.1, 1.2], [0., 0., 1.3], [0., 0., 0.]],
        ...                         [[0., 2.5, 2.6], [0., 0., 2.4], [2.1, 2.2, 2.3]]])
        >>> out6 = paddle.count_nonzero(y, axis=[1, 2])
        >>> out6
        Tensor(shape=[2], dtype=int64, place=Place(cpu), stop_gradient=True,
        [3, 6])
        >>> out7 = paddle.count_nonzero(y, axis=[0, 1])
        >>> out7
        Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [1, 3, 5])
r   r   r[  )rg   rk   rx   r2   r   )rr   rq   rT  r   bool_tensor
int_tensors         rt   count_nonzeror`    sJ    H $v++a(K['2J::jWHHrv   c                $   [        5       (       aH  [        U [        [        R                  R
                  45      (       a  U /n [        R                  " U 5      $ [        S
0 [        5       D6n[        U S[        [        [        4S5        [        U [        [        45      (       a)  [        U 5      S:  a  U  H  n[        US/ SQS5        M     O[        U S/ SQS5        UR                  UR!                  S5      S9nUR#                  SSU 0SU00 S	9  U$ )a  
Sum one or more Tensor of the input.

For example:

.. code-block:: text

    Case 1:

        Input:
            input.shape = [2, 3]
            input = [[1, 2, 3],
                     [4, 5, 6]]

        Output:
            output.shape = [2, 3]
            output = [[1, 2, 3],
                      [4, 5, 6]]

    Case 2:

        Input:
            First input:
                input1.shape = [2, 3]
                Input1 = [[1, 2, 3],
                          [4, 5, 6]]

            The second input:
                input2.shape = [2, 3]
                input2 = [[7, 8, 9],
                          [10, 11, 12]]

            Output:
                output.shape = [2, 3]
                output = [[8, 10, 12],
                          [14, 16, 18]]

Args:
    inputs (Tensor|list[Tensor]|tuple[Tensor]):  A Tensor or a list/tuple of Tensors. The shape and data type of the list/tuple elements should be consistent.
        Input can be multi-dimensional Tensor, and data types can be: bfloat16, float16, float32, float64, int32, int64, complex64, complex128.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, the sum of input :math:`inputs` , its shape and data types are consistent with :math:`inputs`.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> input0 = paddle.to_tensor([[1, 2, 3], [4, 5, 6]], dtype='float32')
        >>> input1 = paddle.to_tensor([[7, 8, 9], [10, 11, 12]], dtype='float32')
        >>> output = paddle.add_n([input0, input1])
        >>> output
        Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[8. , 10., 12.],
         [14., 16., 18.]])
add_nr   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   )rb  )r-   rg   r(   rx   ry   r   r   rb  r)   r   r%   ri   rh   rn   r&   r   input_dtyper   )r   r   r   r   r   s        rt   rb  rb    s   v fx)9)9:;;XF||F##1168ht%<gFftUm,,6{Q#E, 	   $" %	   77$$X. 8 
 	=CL	 	 	
 
rv   c                    [        5       (       a  [        R                  " U 5      $ SU 0n0 n[        S0 [	        5       D6n[        U S/ SQS5        UR                  U R                  S9nUR                  SX#SU0S9  U$ )a  
This API is used to returns a new tensor with the truncated integer values of input.

Args:
    input (Tensor): The input tensor, it's data type should be int32, int64, float32, float64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: The output Tensor of trunc.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> input = paddle.to_tensor([[0.1, 1.5], [-0.2, -2.4]], 'float32')
        >>> output = paddle.trunc(input)
        >>> output
        Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[ 0.,  1.],
         [-0., -2.]])
r   r   r   r   r   r   r   )	r-   r   r   r)   r   r&   r   r   r   )r   r   r   r   r   r   s         rt   r   r   K  s    . ||E""u11 3@'	
 77ekk7Jucl 	 	
 
rv   c                N    [        5       (       a  [        R                  " U 5      $ g)z
Inplace version of ``trunc`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_trunc`.
N)r,   r   trunc_)r   r   s     rt   rf  rf  t  s!     }}U## rv   c                :   [        5       (       a  [        R                  " XSS5      $ S nU" X5        [        5       (       a  [        R                  " XSS5      $ [	        S0 [        5       D6nUR                  U R                  S9nUR                  SXS.SU0S9  U$ )	a  

Applies matrix multiplication to two tensors.

Currently, the input tensors' rank can be any, but when the rank of any
inputs is bigger than 3, this two inputs' rank should be equal.


Also note that if the raw tensor :math:`x` or :math:`mat2` is rank-1 and
nontransposed, the prepended or appended dimension :math:`1` will be
removed after matrix multiplication.

Args:
    input (Tensor): The input tensor which is a Tensor. Support data types: bfloat16, float16, float32,
        float64, int8, int32, int64, complex64, complex128.
    mat2 (Tensor): The input tensor which is a Tensor. Support data types: bfloat16, float16, float32,
        float64, int8, int32, int64, complex64, complex128.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: The product Tensor, with same data type of the input Tensor.

::

    * example 1:

    input: [B, ..., M, K], mat2: [B, ..., K, N]
    out: [B, ..., M, N]

    * example 2:

    input: [B, M, K], mat2: [B, K, N]
    out: [B, M, N]

    * example 3:

    input: [B, M, K], mat2: [K, N]
    out: [B, M, N]

    * example 4:

    input: [M, K], mat2: [K, N]
    out: [M, N]

    * example 5:

    input: [B, M, K], mat2: [K]
    out: [B, M]

    * example 6:

    input: [K], mat2: [K]
    out: [1]

Examples:
    .. code-block:: python

        >>> import paddle
        >>> input = paddle.arange(1, 7).reshape((3, 2)).astype('float32')
        >>> mat2 = paddle.arange(1, 9).reshape((2, 4)).astype('float32')
        >>> out = paddle.mm(input, mat2)
        >>> out
        Tensor(shape=[3, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[11., 14., 17., 20.],
         [23., 30., 37., 44.],
         [35., 46., 57., 68.]])


Fc                0   XS.nUR                  5        H  u  p4[        XC/ SQS5        M     [        U R                  5      n[        UR                  5      n[	        U5      S:X  a  S/UQn[	        U5      S:X  a  / UQSPnUS   US   :w  a$  US   S:X  d  US   S:X  d  [        SU SU S	35      e[	        U5      S
:  aX  [	        U5      S
:  aH  [        US S 5       H5  u  pxUS:  d  Xg   S:  a  M  XU   :w  d  M  [        SU SU SU SU S3	5      e   g g g )Nr   r   r   r   mmr/   r   zAfter performing an optional transpose, Input X's width should be equal to Y's width for multiplication prerequisites. But received X's shape: , Y's shape: 
r#   r   zWhen the matrix is larger than 2 dimensions, the higher dimensional values of the two matrices need to be equal. But received x_shape[z] != y_shape[z]. X's shape: .
)itemsr&   rh   ro   rn   r   r   )	rr   r   	var_namesr   valr  r  idim_xs	            rt   __check_inputmm.<locals>.__check_input  sU   $	"*ID$<d + qww-qww-w<1m7mGw<1#mmG 2;'"+%R[B&GBK2,= >>EYmT[S\\^`  w<!Gq 0%gcrl319
QAJ&$001s-s.QXPY Z&&-Yc3  4 !1rv   r   	matmul_v2r   r   r   )rj  )	r,   r   matmulr.   r)   r   r   r   r   )r   mat2r   rt  r   r   s         rt   rj  rj  ~  s    L }}U%77!F %}}}}U%77.VX.77ekk7J*CL 	 	

 
rv   c           	        U R                   nUR                   nUR                   n[        U5      [        U5      s=:X  a  S:X  d  O  [        SU SU 35      eUS   US   :w  a  [        SU SU S35      e[        U5      S:X  as  US   US   :w  a@  US   S:w  a  [        S	US    35      eUS   US   :w  a  US   S:w  a  [        S
US    35      eUS   US   :w  a  US   S:w  a  [        S
US    35      eOG[        U5      S:X  a*  US   US   S4;  a  [        SU SUS    SUS    S35      eO[        SU 35      e[        5       (       a  [        R
                  " XX#U5      $ XUS.n	XCS.n
[        S0 [        5       D6n[        U S/ SQS5        [        US/ SQS5        [        US/ SQS5        UR                  UR                  S9nUR                  SXSU0S9  U$ )a  
**addmm**

Perform matrix multiplication for input $x$ and $y$.
$input$ is added to the final result.
The equation is:

..  math::
    Out = alpha * x * y + beta * input

$Input$, $x$ and $y$ can carry the LoD (Level of Details) information, or not. But the output only shares the LoD information with input $input$.

Args:
    input (Tensor): The input Tensor to be added to the final result.
    x (Tensor): The first input Tensor for matrix multiplication.
    y (Tensor): The second input Tensor for matrix multiplication.
    beta (float, optional): Coefficient of $input$, default is 1.
    alpha (float, optional): Coefficient of $x*y$, default is 1.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: The output Tensor of addmm.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.ones([2, 2])
        >>> y = paddle.ones([2, 2])
        >>> input = paddle.ones([2, 2])

        >>> out = paddle.addmm(input=input, x=x, y=y, beta=0.5, alpha=5.0)

        >>> print(out)
        Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[10.50000000, 10.50000000],
         [10.50000000, 10.50000000]])
r#   9The dimension of x, y should be 2 but receive x's shape: , y's shape: r/   r   ]The input Variable x's width must be equal with Variable y' height. But received x's shape = , y's shape = r   eWhen x's dimension[0] is not equal with input's dimension[0], input's dimension[0] must be 1 but got eWhen y's dimension[1] is not equal with input's dimension[1], input's dimension[1] must be 1 but got The input's shape: 6 is not broadcastable with [x.shape[0], y.shape[1]]: [,r   CThe dimension of input should be 2 or 1 but receive input's shape: Inputr   r   AlphaBetaaddmmr  r   r   r   r   r   r   r   r   r   )r  )ro   rn   r   r-   r   r  r)   r   r&   r   r   r   r   rr   r   betar   r   input_shaper  r  r   r   r   r   s                rt   r  r    s   ^ ++KggGggGw<3w<,1,GyP]^e]fg
 	
 qzWQZklskt  uC  DK  CL  LM  N
 	
 ;1q>WQZ'1~" {  }H  IJ  }K  |L  M  1~+A!0C {  }H  IJ  }K  |L  M  q>WQZ'1~" {  }H  IJ  }K  |L  M  
[	Q	q>'!*a0%k]2hipqrishttuv}~  wA  vB  BC  D  1
 QR]Q^_
 	
 ||Eau55 q1.11 7G	
 	!s?	
 	!s?	
 77agg7Fucl 	 	
 
rv   c           	        U R                   nUR                   nUR                   n[        U5      [        U5      s=:X  a  S:X  d  O  [        SU SU 35      eUS   US   :w  a  [        SU SU S35      e[        U5      S:X  as  US   US   :w  a@  US   S:w  a  [        S	US    35      eUS   US   :w  a  US   S:w  a  [        S
US    35      eUS   US   :w  a  US   S:w  a  [        S
US    35      eOG[        U5      S:X  a*  US   US   S4;  a  [        SU SUS    SUS    S35      eO[        SU 35      e[        5       (       a  [        R
                  " XX#U5      $ g)z
Inplace version of ``addmm`` API, the output Tensor will be inplaced with input ``input``.
Please refer to :ref:`api_paddle_addmm`.
r#   rz  r{  r/   r   r|  r}  r   r~  r  r  r  r  r   r  N)ro   rn   r   r,   r   addmm_	r   rr   r   r  r   r   r  r  r  s	            rt   r  r  c	  sH    ++KggGggGw<3w<,1,GyP]^e]fg
 	
 qzWQZklskt  uC  DK  CL  LM  N
 	
 ;1q>WQZ'1~" {  }H  IJ  }K  |L  M  1~+A!0C {  }H  IJ  }K  |L  M  q>WQZ'1~" {  }H  IJ  }K  |L  M  
[	Q	q>'!*a0%k]2hipqrishttuv}~  wA  vB  BC  D  1
 QR]Q^_
 	
 }}Uq66 rv   c                .   U R                   nUR                   nUR                   n[        U5      [        U5      s=:X  a  S:X  d  O  [        SU SU 35      eUS   US   :w  a  [        SU SU S35      e[        U5      S:X  Ga  US	   US	   :w  a^  US	   S:w  a  [        S
US	    SUS	    35      eUS   US   :X  d	  US   S:X  a  US   US   :X  d  US   S:X  d  [        SU SU SU 35      eUS   US   :w  a^  US   S:w  a  [        SUS    SUS    35      eUS	   US	   :X  d	  US	   S:X  a  US   US   :X  d  US   S:X  d  [        SU SU SU 35      eUS   US   :w  a   US   S:w  a  [        SUS    SUS    35      eOp[        U5      S:X  aS  US	   US	   :w  a  [        SUS	    SUS	    35      eUS   US   S4;  a!  [        SU SUS	    SUS    SUS    S3	5      eO[        SU 35      e[        5       (       a  [        R
                  " XX#U5      $ XUS.n	XCS.n
[        S$0 [        5       D6n[        U S/ SQS5        [        US/ SQS5        [        US / SQS5        UR                  UR                  S!9nUR                  SXS"U0S#9  U$ )%au  
**baddbmm**

Perform batch matrix multiplication for input $x$ and $y$.
$input$ is added to the final result.
The equation is:

..  math::
    Out = alpha * x * y + beta * input

$Input$, $x$ and $y$ can carry the LoD (Level of Details) information, or not. But the output only shares the LoD information with input $input$.

Args:
    input (Tensor): The input Tensor to be added to the final result.
    x (Tensor): The first input Tensor for batch matrix multiplication.
    y (Tensor): The second input Tensor for batch matrix multiplication.
    beta (float, optional): Coefficient of $input$, default is 1.
    alpha (float, optional): Coefficient of $x*y$, default is 1.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: The output Tensor of baddbmm.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.ones([2, 2, 2])
        >>> y = paddle.ones([2, 2, 2])
        >>> input = paddle.ones([2, 2, 2])

        >>> out = paddle.baddbmm(input=input, x=x, y=y, beta=0.5, alpha=5.0)

        >>> out
        Tensor(shape=[2, 2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[[10.50000000, 10.50000000],
          [10.50000000, 10.50000000]],
         [[10.50000000, 10.50000000],
          [10.50000000, 10.50000000]]])
   9The dimension of x, y should be 3 but receive x's shape: r{  r#   r/   ^The input Variable x's width must be equal with Variable y's height. But received x's shape = r}  r   r   ~If input's dimension[0] is not equal to x's dimension[0], input's dimension[0] must be 1. But received input's dimension[0] = , x's dimension[0] = If input's dimension[0] is 1, input's dimension[1] and dimension[2] must be equal to x's dimension[1] and y's dimension[2] respectively, or they must be 1. But received input's shape = , x's shape = ~If input's dimension[1] is not equal to x's dimension[1], input's dimension[1] must be 1. But received input's dimension[1] = , x's dimension[1] = If input's dimension[1] is 1, input's dimension[0] and dimension[2] must be equal to x's dimension[0] and y's dimension[2] respectively, or they must be 1. But received input's shape = ~If input's dimension[2] is not equal to y's dimension[2], input's dimension[2] must be 1. But received input's dimension[2] = , y's dimension[2] = `The batch size of input must be equal to the batch size of x. But received input's batch size = , x's batch size = r  B is not broadcastable with [x.shape[0], x.shape[1], y.shape[2]]: [r  r   DThe dimension of input should be 3 or 2 but received input's shape: r  r  baddbmmr  r  r   r   r   r   r   )r  )ro   rn   r   r-   r   r  r)   r   r&   r   r   r   r  s                rt   r  r  	  s   b ++KggGggGw<3w<,1,GyP]^e]fg
 	
 qzWQZlmtlu  vD  EL  DM  MN  O
 	
 ;1q>WQZ'1~"  U  Va  bc  Vd  Ue  ez  {B  CD  {E  zF  G 
  Ngaj0KNa4G%a.GAJ6+a.A:M$ T  U`  Ta  ao  pw  ox  xF  GN  FO  P  q>WQZ'1~"  U  Va  bc  Vd  Ue  ez  {B  CD  {E  zF  G 
  Ngaj0KNa4G%a.GAJ6+a.A:M$ T  U`  Ta  ao  pw  ox  xF  GN  FO  P  q>WQZ'1~"  U  Va  bc  Vd  Ue  ez  {B  CD  {E  zF  G  
[	Q	q>WQZ'rs~  @A  tB  sC  CV  W^  _`  Wa  Vb  c  q>'!*a0%k]2tu|}~u  uA  AB  CJ  KL  CM  BN  NO  PW  XY  PZ  O[  [\  ]  1
 RS^R_`
 	
 ~~e77 q1.3&(3 7		
 	!s?	
 	!s?	
 77agg7F6 	 	
 
rv   c                <   U R                   nUR                   nUR                   n[        U5      [        U5      s=:X  a  S:X  d  O  [        SU SU 35      eUS   US   :w  a  [        SU SU S35      e[        U5      S:X  Ga  US	   US	   :w  a^  US	   S:w  a  [        S
US	    SUS	    35      eUS   US   :X  d	  US   S:X  a  US   US   :X  d  US   S:X  d  [        SU SU SU 35      eUS   US   :w  a^  US   S:w  a  [        SUS    SUS    35      eUS	   US	   :X  d	  US	   S:X  a  US   US   :X  d  US   S:X  d  [        SU SU SU 35      eUS   US   :w  a   US   S:w  a  [        SUS    SUS    35      eOp[        U5      S:X  aS  US	   US	   :w  a  [        SUS	    SUS	    35      eUS   US   S4;  a!  [        SU SUS	    SUS    SUS    S3	5      eO[        SU 35      e[        5       (       a  [        R
                  " XX#U5      $ g)z
Inplace version of ``baddbmm`` API, the output Tensor will be inplaced with input ``input``.
Please refer to :ref:`api_paddle_baddbmm`.
r  r  r{  r#   r/   r  r}  r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  N)ro   rn   r   r,   r   baddbmm_r  s	            rt   r  r  
  sc    ++KggGggGw<3w<,1,GyP]^e]fg
 	
 qzWQZlmtlu  vD  EL  DM  MN  O
 	
 ;1q>WQZ'1~"  U  Va  bc  Vd  Ue  ez  {B  CD  {E  zF  G 
  Ngaj0KNa4G%a.GAJ6+a.A:M$ T  U`  Ta  ao  pw  ox  xF  GN  FO  P  q>WQZ'1~"  U  Va  bc  Vd  Ue  ez  {B  CD  {E  zF  G 
  Ngaj0KNa4G%a.GAJ6+a.A:M$ T  U`  Ta  ao  pw  ox  xF  GN  FO  P  q>WQZ'1~"  U  Va  bc  Vd  Ue  ez  {B  CD  {E  zF  G  
[	Q	q>WQZ'rs~  @A  tB  sC  CV  W^  _`  Wa  Vb  c  q>'!*a0%k]2tu|}~u  uA  AB  CJ  KL  CM  BN  NO  PW  XY  PZ  O[  [\  ]  1
 RS^R_`
 	
 u%88 rv   c           	        U R                   nU[        U5      :  d  [        SU S[        U5       SU 35      eUS:  d=  US[        U5      -  :  d  [        SU SS[        U5      -   35      eU[        U5      -   n[        5       (       a  [        R
                  " XX#5      nU$ [        U SSS	/S
5        SU 0nXUS.n[        S0 [        5       D6nUR                  U R                  S9nUR                  S
XgSU0S9  U$ )a  
**renorm**

This operator is used to calculate the p-norm along the axis,
suppose the input-shape on axis dimension has the value of T, then
the tensor is split into T parts, the p-norm should be calculated for each
part, if the p-norm for part i is larger than max-norm, then each element
in part i should be re-normalized at the same scale so that part-i' p-norm equals
max-norm exactly, otherwise part-i stays unchanged.

Args:
    x (Tensor): The input Tensor
    p (float): The power of the norm operation.
    axis (int): the dimension to slice the tensor.
    max-norm (float): the maximal norm limit.

Returns:
    Tensor: the renorm Tensor.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> input = [[[2.0, 2.0, -2.0], [3.0, 0.3, 3.0]],
        ...          [[2.0, -8.0, 2.0], [3.1, 3.7, 3.0]]]
        >>> x = paddle.to_tensor(input,dtype='float32')
        >>> y = paddle.renorm(x, 1.0, 2, 2.05)
        >>> print(y)
        Tensor(shape=[2, 2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[[ 0.40594056,  0.29285714, -0.41000000],
          [ 0.60891086,  0.04392857,  0.61500001]],
         [[ 0.40594056, -1.17142856,  0.41000000],
          [ 0.62920785,  0.54178572,  0.61500001]]])

	the axis:& should be less then the shape's size :r   r   4 should not be less than -1 * length of input_shape:rr   r   r   renormr   )prq   max_normr   r   r   )r  )ro   rn   r   r-   r   r  r&   r)   r   r   r   r   )	rr   r  rq   r  r  r   r   r   r   s	            rt   r  r  i
  s/   H ''K#k""vCCDTCUUVWbVcd
 	
 19rC,,,D6!UVX[^_j[kVkUlm  c+&&mmA$1
 C)Y)?Jq8<2277agg7F&s| 	 	
 
rv   c           	     J   U R                   nU[        U5      :  d  [        SU S[        U5       SU 35      eUS:  d=  US[        U5      -  :  d  [        SU SS[        U5      -   35      eU[        U5      -   n[        5       (       a  [        R
                  " XX#5      nU$ g)z
Inplace version of ``renorm`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_renorm`.
r  r  r  r   r   r  N)ro   rn   r   r,   r   renorm_)rr   r  rq   r  r  r   s         rt   r  r  
  s     ''K#k""vCCDTCUUVWbVcd
 	
 19rC,,,D6!UVX[^_j[kVkUlm  c+&&nnQ42
 rv   c                  ^	^
 U R                   m	UR                   m
[        5       (       a+  U R                  S:X  d  UR                  S:X  a  [        X5      $ [	        T	SS 5      [	        T
SS 5      -   nT	S   S:X  aL  [        T	5      S:X  a  U R                  S5      nOAU R                  [        R                  " T	SS 5      S45      nOU R                  ST	S   45      nT
S   S:X  aL  [        T
5      S:X  a  UR                  S5      nOAUR                  [        R                  " T
SS 5      S45      nOUR                  ST
S   45      nU	U
4S jnU" XE5        [        5       (       a'  [        R                  " XESS5      R                  U5      $ [        S0 [        5       D6nUR                  UR                  S	9nUR!                  S
XER"                  S.SU0S9  UR                  U5      $ )a  

Inner product of two input Tensor.

Ordinary inner product for 1-D Tensors, in higher dimensions a sum product over the last axes.

Args:
    x (Tensor): An N-D Tensor or a Scalar Tensor. If its not a scalar Tensor, its last dimensions must match y's.
    y (Tensor): An N-D Tensor or a Scalar Tensor. If its not a scalar Tensor, its last dimensions must match x's.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: The inner-product Tensor, the output shape is x.shape[:-1] + y.shape[:-1].

Examples:
    .. code-block:: python

        >>> import paddle
        >>> x = paddle.arange(1, 7).reshape((2, 3)).astype('float32')
        >>> y = paddle.arange(1, 10).reshape((3, 3)).astype('float32')
        >>> out = paddle.inner(x, y)
        >>> print(out)
        Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[14. , 32. , 50. ],
         [32. , 77. , 122.]])


r/   Nr   r   r/   r   c                   > XS.nUR                  5        H  u  p4[        XC/ SQS5        M     [        T5      n[        T5      nUS   US   :w  a&  US   S:X  d  US   S:X  d  [        SU SU S35      eg g g )Nr   ri  innerr   zAfter performing an optional transpose, Input X's last dim should be equal to Y's last dim for multiplication prerequisites. But received X's shape: rl  rm  )ro  r&   rh   r   )	rr   r   rp  r   rq  r  r  xshapeyshapes	          rt   rt  inner.<locals>.__check_input
  s    (I&__.	(@' / 6lG6lG r{gbk) *r0A$BBI-X_W``bd  1B* *rv   FTr   rv  r   r   r   )r  )ro   r,   sizer   rh   rn   r  mathprodr-   r   rw  r)   r   r   r   r   T)rr   r   r   dstshapenxnyrt  r   r   r  r  s            @@rt   r  r  
  s   : WWFWWFaffkQVVq[~s$tF3BK'88":?6{aYYv&YY		&"+ 6:;Br
+,B":?6{aYYv&YY		&"+ 6:;Br
+,B	$ 	b!##==5==hGG 5FH5F;;"((;KC dd+  
 ;;x((rv   vec2c                  U R                   nUR                   n[        R                  " U5      S:X  a  U R                  S5      nOU R                  S5      n[        R                  " U5      S:X  a  UR                  S5      nOUR                  S5      n[	        5       (       a  [
        R                  " XgUS9$ [        S0 [        5       D6nUR                  UR                  S9nUR                  SXgS	.S
U0S9  U$ )a  

Outer product of two Tensors.

Input is flattened if not already 1-dimensional.

.. note::
    Alias Support: The parameter name ``input`` can be used as an alias for ``x``, and ``vec2`` can be used as an alias for ``y``.
    For example, ``outer(input=tensor_x, vec2=tensor_y, ...)`` is equivalent to ``outer(x=tensor_x, y=tensor_y, ...)``.

Args:
    x (Tensor): An N-D Tensor or a Scalar Tensor.
        alias: ``input``.
    y (Tensor): An N-D Tensor or a Scalar Tensor.
        alias: ``vec2``.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
    out (Tensor|None, optional): The output Tensor. If set, the result will be stored in this Tensor.

Returns:
    Tensor: The outer-product Tensor.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> x = paddle.arange(1, 4).astype('float32')
        >>> y = paddle.arange(1, 6).astype('float32')
        >>> out = paddle.outer(x, y)
        >>> print(out)
        Tensor(shape=[3, 5], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[1. , 2. , 3. , 4. , 5. ],
         [2. , 4. , 6. , 8. , 10.],
         [3. , 6. , 9. , 12., 15.]])


r   )r   r/   )r   r/   r  )r/   r   r   r   rv  r   r   r   )outer)ro   r  r  r  r-   r   r   r)   r   r   r   r   )	rr   r   r   r   r  r  r  r  r   s	            rt   r  r    s    X WWFWWFyyAYYvYYwyyAYYvYYwr3//1177bhh7G2%7% 	 	
 
rv   c                    [        5       (       a  [        R                  " U 5      $ S nU" U 5        [        S0 [	        5       D6nUR                  U R                  S9nUR                  SSU /0SU/0S9  U$ )a$  
Takes the inverse of the square matrix. A square matrix is a matrix with
the same number of rows and columns. The input can be a square matrix
(2-D Tensor) or batches of square matrices.

Args:
    x (Tensor): The input tensor. The last two
        dimensions should be equal. When the number of dimensions is
        greater than 2, it is treated as batches of square matrix. The data
        type can be float32, float64, complex64, complex128.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: A Tensor holds the inverse of x. The shape and data type
                    is the same as x.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> mat = paddle.to_tensor([[2, 0], [0, 2]], dtype='float32')
        >>> inv = paddle.inverse(mat)
        >>> print(inv)
        Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[0.50000000, 0.        ],
         [0.        , 0.50000000]])

c                    [        U S/ SQS5        [        U R                  5      S:  a/  [        S[        U R                  5       SU R                   S35      eg )Nrr   )r   r   r   r   inverser#   zlThe input of inverse is expected to be a Tensor whose number of dimensions is no less than 2. But received: z, x's shape: r   )r&   rn   ro   r   )rr   s    rt   _check_inputinverse.<locals>._check_inputv  sc    $A	 177|a FFI!''l^ T""#''!-   rv   r  r   r  Outputr   )r  )r-   r   r  r)   r   r   r   r   )rr   r   r  r   r   s        rt   r  r  T  s~    < ~~a  	 	Q3&(377agg7FGaS>Hse;L 	 	
 
rv   >   dimr   r   z
paddle.maxzpaddle.compat.maxz	torch.max)illegal_keys	func_namecorrect_name
url_suffixc           	        [        5       (       a  [        R                  " XU5      $ [        X5      u  pA[	        5       (       a  [        R                  " XU5      $ [        S
0 [        5       D6n[        U S/ SQS5        [        U[        5      (       dC  [        R                  R                  U5      (       a  [        R                  R                  U5      nUR                  U R                  S9nUR!                  SSU 0SU0UUUS.S	9  U$ )a  

Computes the maximum of tensor elements over the given axis.

Note:
    The difference between max and amax is: If there are multiple maximum elements,
    amax evenly distributes gradient between these equal values,
    while max propagates gradient to all of them.


Args:
    x (Tensor): A tensor, the data type is float8_e4m3fn, float8_e5m2, bfloat16, float16, float32, float64, int32, int64.
    axis (int|list|tuple|None, optional): The axis along which the maximum is computed.
        If :attr:`None`, compute the maximum over all elements of
        `x` and return a Tensor with a single element,
        otherwise must be in the range :math:`[-x.ndim(x), x.ndim(x))`.
        If :math:`axis[i] < 0`, the axis to reduce is :math:`x.ndim + axis[i]`.
    keepdim (bool, optional): Whether to reserve the reduced dimension in the
        output Tensor. The result tensor will have one fewer dimension
        than the `x` unless :attr:`keepdim` is true, default
        value is False.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, results of maximum on the specified axis of input tensor,
    it's data type is the same as `x`.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> # data_x is a Tensor with shape [2, 4]
        >>> # the axis is a int element
        >>> x = paddle.to_tensor([[0.2, 0.3, 0.5, 0.9],
        ...                       [0.1, 0.2, 0.6, 0.7]],
        ...                       dtype='float64', stop_gradient=False)
        >>> result1 = paddle.max(x)
        >>> result1.backward()
        >>> result1
        Tensor(shape=[], dtype=float64, place=Place(cpu), stop_gradient=False,
        0.90000000)
        >>> x.grad
        Tensor(shape=[2, 4], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[0., 0., 0., 1.],
         [0., 0., 0., 0.]])

        >>> x.clear_grad()
        >>> result2 = paddle.max(x, axis=0)
        >>> result2.backward()
        >>> result2
        Tensor(shape=[4], dtype=float64, place=Place(cpu), stop_gradient=False,
        [0.20000000, 0.30000000, 0.60000000, 0.90000000])
        >>> x.grad
        Tensor(shape=[2, 4], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[1., 1., 0., 1.],
         [0., 0., 1., 0.]])

        >>> x.clear_grad()
        >>> result3 = paddle.max(x, axis=-1)
        >>> result3.backward()
        >>> result3
        Tensor(shape=[2], dtype=float64, place=Place(cpu), stop_gradient=False,
        [0.90000000, 0.70000000])
        >>> x.grad
        Tensor(shape=[2, 4], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[0., 0., 0., 1.],
         [0., 0., 0., 1.]])

        >>> x.clear_grad()
        >>> result4 = paddle.max(x, axis=1, keepdim=True)
        >>> result4.backward()
        >>> result4
        Tensor(shape=[2, 1], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[0.90000000],
         [0.70000000]])
        >>> x.grad
        Tensor(shape=[2, 4], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[0., 0., 0., 1.],
         [0., 0., 0., 1.]])

        >>> # data_y is a Tensor with shape [2, 2, 2]
        >>> # the axis is list
        >>> y = paddle.to_tensor([[[1.0, 2.0], [3.0, 4.0]],
        ...                         [[5.0, 6.0], [7.0, 8.0]]],
        ...                         dtype='float64', stop_gradient=False)
        >>> result5 = paddle.max(y, axis=[1, 2])
        >>> result5.backward()
        >>> result5
        Tensor(shape=[2], dtype=float64, place=Place(cpu), stop_gradient=False,
        [4., 8.])
        >>> y.grad
        Tensor(shape=[2, 2, 2], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[[0., 0.],
          [0., 1.]],
         [[0., 0.],
          [0., 1.]]])

        >>> y.clear_grad()
        >>> result6 = paddle.max(y, axis=[0, 1])
        >>> result6.backward()
        >>> result6
        Tensor(shape=[2], dtype=float64, place=Place(cpu), stop_gradient=False,
        [7., 8.])
        >>> y.grad
        Tensor(shape=[2, 2, 2], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[[0., 0.],
          [0., 0.]],
         [[0., 0.],
          [1., 1.]]])
r@  rr   )r   r   r   r   r   r   float8_e4m3fnfloat8_e5m2r   
reduce_maxr   r   r  keep_dimrs   r   )r@  )r,   r   r@  r}   r.   r)   r   r&   rg   r(   rx   rz   r{   r|   r   r   r   rr   rq   rT  r   rs   r   r   s          rt   r@  r@    s    v zz!7++7@
==::aw// 3&(3F$	  dH--&,,2K2K3 3 ||;;DA;;!'';JC!Qx '",	  	 Jrv   z
paddle.minzpaddle.compat.minz	torch.minc           	     d   [        5       (       a  [        R                  " XU5      $ [        X5      u  pA[	        5       (       a  [        R                  " XU5      $ [        S
0 [        5       D6n[        U S/ SQS5        UR                  U R                  S9nUR                  SSU 0SU0UUUS.S	9  U$ )a  

Computes the minimum of tensor elements over the given axis

Note:
    The difference between min and amin is: If there are multiple minimum elements,
    amin evenly distributes gradient between these equal values,
    while min propagates gradient to all of them.

Args:
    x (Tensor): A tensor, the data type is bfloat16, float16, float32, float64, int32, int64.
    axis (int|list|tuple|None, optional): The axis along which the minimum is computed.
        If :attr:`None`, compute the minimum over all elements of
        `x` and return a Tensor with a single element,
        otherwise must be in the range :math:`[-x.ndim, x.ndim)`.
        If :math:`axis[i] < 0`, the axis to reduce is :math:`x.ndim + axis[i]`.
    keepdim (bool, optional): Whether to reserve the reduced dimension in the
        output Tensor. The result tensor will have one fewer dimension
        than the `x` unless :attr:`keepdim` is true, default
        value is False.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, results of minimum on the specified axis of input tensor,
    it's data type is the same as input's Tensor.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> # data_x is a Tensor with shape [2, 4]
        >>> # the axis is a int element
        >>> x = paddle.to_tensor([[0.2, 0.3, 0.5, 0.9],
        ...                       [0.1, 0.2, 0.6, 0.7]],
        ...                       dtype='float64', stop_gradient=False)
        >>> result1 = paddle.min(x)
        >>> result1.backward()
        >>> result1
        Tensor(shape=[], dtype=float64, place=Place(cpu), stop_gradient=False,
        0.10000000)
        >>> x.grad
        Tensor(shape=[2, 4], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[0., 0., 0., 0.],
         [1., 0., 0., 0.]])

        >>> x.clear_grad()
        >>> result2 = paddle.min(x, axis=0)
        >>> result2.backward()
        >>> result2
        Tensor(shape=[4], dtype=float64, place=Place(cpu), stop_gradient=False,
        [0.10000000, 0.20000000, 0.50000000, 0.70000000])
        >>> x.grad
        Tensor(shape=[2, 4], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[0., 0., 1., 0.],
         [1., 1., 0., 1.]])

        >>> x.clear_grad()
        >>> result3 = paddle.min(x, axis=-1)
        >>> result3.backward()
        >>> result3
        Tensor(shape=[2], dtype=float64, place=Place(cpu), stop_gradient=False,
        [0.20000000, 0.10000000])
        >>> x.grad
        Tensor(shape=[2, 4], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[1., 0., 0., 0.],
         [1., 0., 0., 0.]])

        >>> x.clear_grad()
        >>> result4 = paddle.min(x, axis=1, keepdim=True)
        >>> result4.backward()
        >>> result4
        Tensor(shape=[2, 1], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[0.20000000],
         [0.10000000]])
        >>> x.grad
        Tensor(shape=[2, 4], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[1., 0., 0., 0.],
         [1., 0., 0., 0.]])

        >>> # data_y is a Tensor with shape [2, 2, 2]
        >>> # the axis is list
        >>> y = paddle.to_tensor([[[1.0, 2.0], [3.0, 4.0]],
        ...                       [[5.0, 6.0], [7.0, 8.0]]],
        ...                       dtype='float64', stop_gradient=False)
        >>> result5 = paddle.min(y, axis=[1, 2])
        >>> result5.backward()
        >>> result5
        Tensor(shape=[2], dtype=float64, place=Place(cpu), stop_gradient=False,
        [1., 5.])
        >>> y.grad
        Tensor(shape=[2, 2, 2], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[[1., 0.],
          [0., 0.]],
         [[1., 0.],
          [0., 0.]]])

        >>> y.clear_grad()
        >>> result6 = paddle.min(y, axis=[0, 1])
        >>> result6.backward()
        >>> result6
        Tensor(shape=[2], dtype=float64, place=Place(cpu), stop_gradient=False,
        [1., 2.])
        >>> y.grad
        Tensor(shape=[2, 2, 2], dtype=float64, place=Place(cpu), stop_gradient=False,
        [[[1., 1.],
          [0., 0.]],
         [[0., 0.],
          [0., 0.]]])
rA  rr   )r   r   r   r   r   r   r   
reduce_minr   r   r  r   )rA  )r,   r   rA  r}   r.   r)   r   r&   r   r   r   r  s          rt   rA  rA  2  s    t zz!7++7@
==::aw// 3&(3F$M	 ;;!'';JC!Qx '",	  	 Jrv   c                N    [        5       (       a  [        R                  " U 5      $ g)z
Inplace version of ``log1p`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_log1p`.
N)r,   r   log1p_r   s     rt   r  r    !     }}Q rv   c                N    [        5       (       a  [        R                  " U 5      $ g)z
Inplace version of ``log2`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_log2`.
N)r,   r   log2_r   s     rt   r  r    s      ||A rv   c                N    [        5       (       a  [        R                  " U 5      $ g)z
Inplace version of ``log10`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_log10`.
N)r,   r   log10_r   s     rt   r  r    r  rv   c               6   [        U R                  5      nUS:X  aa  [        R                  " [        R                  5      R
                  n[        R                  " [        R                  5      R                  S-
  nGOUS:X  aa  [        R                  " [        R                  5      R
                  n[        R                  " [        R                  5      R                  S-
  nGOXUS:X  ao  [        [        R                  " [        R                  5      R
                  5      n[        [        R                  " [        R                  5      R                  5      nOUS:X  ao  [        [        R                  " [        R                  5      R
                  5      n[        [        R                  " [        R                  5      R                  5      nOn[        [        R                  " [        R                  5      R
                  5      n[        [        R                  " [        R                  5      R                  5      nUc  UOUnUc  UOUn[        5       (       a  US;   a  [        U[        R                   5      (       a  UR#                  S5      n[        U[        R                   5      (       a  UR#                  S5      n[        U[        5      (       d  [        U[        5      (       a%  [        R$                  " U [        R                  5      n [&        R(                  " XX$S	9$ [+        5       (       Ga  US;   a  [        U[        5      (       d  [        U[        5      (       d  [        U[        R,                  R.                  5      (       a.  UR                  [        R                  [        R                  4;   dW  [        U[        R,                  R.                  5      (       aS  UR                  [        R                  [        R                  4;   a%  [        R$                  " U [        R                  5      n [&        R(                  " XX$S	9$ UbM  [1        US
[        [2        [4        4S5        [        U[4        5      (       a  [7        UR                  S
/ SQSS5        UbM  [1        US[        [2        [4        4S5        [        U[4        5      (       a  [7        UR                  S/ SQSS5        [9        U S/ SQS5        SU 0nXgS.n	[        U[4        5      (       a  SUl        XS'   OUb  XS
'   [        U[4        5      (       a  SUl        X(S'   OUb  X)S'   [=        S0 [?        5       D6n
U
RA                  U
RC                  S5      S9nU
RE                  SUSU/0U	S9  U$ )a  
This operator clip all elements in input into the range [ min, max ] and return
a resulting tensor as the following equation:

.. math::

    Out = MIN(MAX(x, min), max)

.. note::
    Alias Support: The parameter name ``input`` can be used as an alias for ``x``.
    For example, ``clip(input=tensor_x)`` is equivalent to ``clip(x=tensor_x)``.

Args:
    x (Tensor): An N-D Tensor with data type bfloat16, float16, float32, float64, int32 or int64.
        alias: ``input``.
    min (float|int|Tensor, optional): The lower bound with type ``float`` , ``int`` or a ``0-D Tensor``
        with shape [] and type ``bfloat16``, ``float16``, ``float32``, ``float64``, ``int32``.
    max (float|int|Tensor, optional): The upper bound with type ``float``, ``int`` or a ``0-D Tensor``
        with shape [] and type ``bfloat16``, ``float16``, ``float32``, ``float64``, ``int32``.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
    out (Tensor, optional): The output Tensor. If set, the result will be stored in this Tensor. Default: None.

Returns:
    Tensor: A Tensor with the same data shape as input. If either min or max is a floating-point value/Tensor, the output tensor will have a data type of ``float32``. Otherwise, the output tensor will inherit the same data type as the input.


Examples:
    .. code-block:: python

        >>> import paddle

        >>> x1 = paddle.to_tensor([[1.2, 3.5], [4.5, 6.4]], 'float32')
        >>> out1 = paddle.clip(x1, min=3.5, max=5.0)
        >>> out1
        Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[3.50000000, 3.50000000],
         [4.50000000, 5.        ]])
        >>> out2 = paddle.clip(x1, min=2.5)
        >>> out2
        Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[2.50000000, 3.50000000],
         [4.50000000, 6.40000010]])
paddle.int32   paddle.int64l        zpaddle.float16zpaddle.float64)r  r  r   r   rA  clip)r   r   r   r   r   z+(When the type of min in clip is Variable.)r@  z+(When the type of max in clip is Variable.)rr   rQ  r   )rA  r@  TMinMaxr   r   r   )r  )#r   r   r>  iinfor   rA  r@  r   r   r?  r   r   r   r,   rg   rx   rc   itemr2   r   r  r.   ry   r   r%   rk   r(   r$   r&   stop_gradientr)   r   r   rc  r   )rr   rA  r@  r   r   x_dtypemin_max_r   r   r   r   s               rt   r  r    s   j !''lG. xx!%%xx!%%,	N	"xx!%%xx!%%-	$	$RXXbjj)--.RXXbjj)--.	$	$RXXbjj)--.RXXbjj)--.RXXbjj)--.RXXbjj)--.+$3C+$3C66#v}}--hhqk#v}}--hhqk#u%%C)?)?KK6>>2{{1300	663&&c5))sFJJ$4$455		fnnfnn%EE sFJJ$4$455		fnnfnn%EE KK6>>2{{1300?sEE3#96B#x((IIHA ?sEE3#96B#x((IIHA 	!I		
 q*c8$$ $C5M_%Lc8$$ $C5M_%L0vx0::$$S) ; 
 	0A 	 	
 rv   c                   [        [        R                  " [        R                  5      R                  5      n[        [        R                  " [        R                  5      R
                  5      n[        U[        5      (       a  UR                  S5      n[        U[        5      (       a  UR                  S5      nUc  UOUnUc  UOUn[        5       (       a  [        R                  " XU5      $ g)z
Inplace version of ``clip`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_clip`.
r   N)r   r>  r?  r   rA  r@  rg   r(   r  r,   r   clip_)rr   rA  r@  r   r3  r/  s         rt   r  r    s     "**%))*D"**%))*D#x  hhqk#x  hhqk+$3C+$3C||AC(( rv   c                    S n[        5       (       a  [        R                  " XX#5      $ U" XX#5        [        S0 [	        5       D6nUR                  U R                  S9nUR                  SSU /0XUS.SU/0S9  U$ )	a  

Computes the sum along diagonals of the input tensor x.

If ``x`` is 2D, returns the sum of diagonal.

If ``x`` has larger dimensions, then returns an tensor of diagonals sum, diagonals be taken from
the 2D planes specified by axis1 and axis2. By default, the 2D planes formed by the first and second axes
of the input tensor x.

The argument ``offset`` determines where diagonals are taken from input tensor x:

- If offset = 0, it is the main diagonal.
- If offset > 0, it is above the main diagonal.
- If offset < 0, it is below the main diagonal.
- Note that if offset is out of input's shape indicated by axis1 and axis2, 0 will be returned.
.. note::
    Alias Support: The parameter name ``input`` can be used as an alias for ``x``.
    For example, ``trace(input=x)`` is equivalent to ``trace(x=x)``.
Args:
    x (Tensor): The input tensor x. Must be at least 2-dimensional. The input data type should be float16, float32, float64, int32, int64.
        alias: ``input``.
    offset (int, optional): Which diagonals in input tensor x will be taken. Default: 0 (main diagonals).
    axis1 (int, optional): The first axis with respect to take diagonal. Default: 0.
    axis2 (int, optional): The second axis with respect to take diagonal. Default: 1.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: the output data type is the same as input data type.

Examples:
    .. code-block:: pycon

        >>> import paddle

        >>> case1 = paddle.randn([2, 3])
        >>> case2 = paddle.randn([3, 10, 10])
        >>> case3 = paddle.randn([3, 10, 5, 10])
        >>> data1 = paddle.trace(case1)
        >>> data1.shape
        paddle.Size([])
        >>> data2 = paddle.trace(case2, offset=1, axis1=1, axis2=2)
        >>> data2.shape
        paddle.Size([3])
        >>> data3 = paddle.trace(case3, offset=-3, axis1=1, axis2=-1)
        >>> data3.shape
        paddle.Size([3, 5])
c                   [        U R                  S/ SQS5        [        U R                  5      n[	        U5      S:  d   S[	        U5       S35       eUS:  a  UO[	        U5      U-   nUS:  a  UO[	        U5      U-   nSU::  a  U[	        U5      :  d'   S[	        U5      *  S	[	        U5      S
-
   SU S35       eSU::  a  U[	        U5      :  d'   S[	        U5      *  S	[	        U5      S
-
   SU S35       eXV:w  d   SU SU S35       eg )Nr  r   r   r   r   r   tracer#   zJThe x must be at least 2-dimensional, But received Input x's dimensional: rn  r   z@The argument axis1 is out of range (expected to be in range of [z, r/   z], but got z).
z@The argument axis2 is out of range (expected to be in range of [z=axis1 and axis2 cannot be the same axis.But received axis1 = z
, axis2 = rm  )r$   r   rh   ro   rn   )rr   offsetaxis1axis2r  axis1_axis2_s          rt   rt  trace.<locals>.__check_input  s   GG?		
 177m;1$ 	
336{3C2DCI	
$
  1*#k*:U*B1*#k*:U*BV&3{+;"; 	
NQTU`QaObNccefijufvyzfze{  |G  HM  GN  NR  S	
< V&3{+;"; 	
NQTU`QaObNccefijufvyzfze{  |G  HM  GN  NR  S	
<  	
$$)7*UG2?	
rv   r  r   r  )r  r  r  r   r   )r  )r-   r   r  r)   r   r   r   r   )rr   r  r  r  r   rt  r   r   s           rt   r  r    s    r
< ||Au44a.1177agg7FaS>#eDSEN	 	 	
 
rv   c                   [        5       (       a  [        R                  " X5      $ [        S	0 [	        5       D6n[        U S/ SQS5        [        US/ SQS5        UR                  U R                  S9nUR                  SXS.SU0S9  U$ )
a  
Compute the Kronecker product of two tensors, a
composite tensor made of blocks of the second tensor scaled by the
first.
Assume that the rank of the two tensors, $X$ and $Y$
are the same, if necessary prepending the smallest with ones. If the
shape of $X$ is [$r_0$, $r_1$, ..., $r_N$] and the shape of $Y$ is
[$s_0$, $s_1$, ..., $s_N$], then the shape of the output tensor is
[$r_{0}s_{0}$, $r_{1}s_{1}$, ..., $r_{N}s_{N}$]. The elements are
products of elements from $X$ and $Y$.
The equation is:
$$
output[k_{0}, k_{1}, ..., k_{N}] = X[i_{0}, i_{1}, ..., i_{N}] *
Y[j_{0}, j_{1}, ..., j_{N}]
$$
where
$$
k_{t} = i_{t} * s_{t} + j_{t}, t = 0, 1, ..., N
$$

Args:
    x (Tensor): the first operand of kron op, data type: bfloat16, float16, float32, float64, int32 or int64.
    y (Tensor): the second operand of kron op, data type: bfloat16, float16, float32, float64, int32 or int64. Its data type should be the same with x.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: The output of kron, data type: bfloat16, float16, float32, float64, int32 or int64. Its data is the same with x.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> x = paddle.to_tensor([[1, 2], [3, 4]], dtype='int64')
        >>> y = paddle.to_tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype='int64')
        >>> out = paddle.kron(x, y)
        >>> out
        Tensor(shape=[6, 6], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[1 , 2 , 3 , 2 , 4 , 6 ],
         [4 , 5 , 6 , 8 , 10, 12],
         [7 , 8 , 9 , 14, 16, 18],
         [3 , 6 , 9 , 4 , 8 , 12],
         [12, 15, 18, 16, 20, 24],
         [21, 24, 27, 28, 32, 36]])
kronrr   rQ  r   r   r   r   r   )r  )	r-   r   r  r)   r   r&   r   r   r   rr   r   r   r   r   s        rt   r  r    s    Z {{1  0vx0 I		
 	!I		
 77agg7Fa 05#, 	 	
 
rv   r  c          	     P   Uc  SnOSnUcY  U R                   [        R                  [        R                  [        R                  [        R
                  4;   a  [        U S5      n O&[        U5      nU R                   U:w  a  [        X5      n [        5       (       a  Uc  Sn[        R                  " XUSSUS9$ [        U S/ SQS5        [        U S[        S5        [        5       R                  5       n0 nUR!                  5        H  u  p8Uc  M
  XU'   M     [#        S5      n	U	" S	0 UD6$ )
a  
The cumulative sum of the elements along a given axis.

Note:
    The first element of the result is the same as the first element of the input.

.. note::
    Alias Support: The parameter name ``input`` can be used as an alias for ``x``, and ``dim`` can be used as an alias for ``axis``.
    For example, ``cumsum(input=tensor_x, dim=1, ...)`` is equivalent to ``cumsum(x=tensor_x, axis=1, ...)``.

Args:
    x (Tensor): The input tensor needed to be cumsumed.
        alias: ``input``.
    axis (int, optional): The dimension to accumulate along. -1 means the last dimension. The default (None) is to compute the cumsum over the flattened array.
        alias: ``dim``.
    dtype (str|paddle.dtype|np.dtype|None, optional): The data type of the output tensor, can be bfloat16, float16, float32, float64, int32, int64, complex64, complex128. By default, it is int64 if the input x is int8/int16/int32; otherwise, it is None. If it is not None, the input tensor is casted to dtype before the operation is performed. This is useful for preventing data type overflows.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
    out (Tensor, optional): The output tensor. If provided, the result will be stored in this tensor.

Returns:
    Tensor, the result of cumsum operator.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> data = paddle.arange(12)
        >>> data = paddle.reshape(data, (3, 4))

        >>> y = paddle.cumsum(data)
        >>> y
        Tensor(shape=[12], dtype=int64, place=Place(cpu), stop_gradient=True,
        [0 , 1 , 3 , 6 , 10, 15, 21, 28, 36, 45, 55, 66])

        >>> y = paddle.cumsum(data, axis=0)
        >>> y
        Tensor(shape=[3, 4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[0 , 1 , 2 , 3 ],
         [4 , 6 , 8 , 10],
         [12, 15, 18, 21]])

        >>> y = paddle.cumsum(data, axis=-1)
        >>> y
        Tensor(shape=[3, 4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[0 , 1 , 3 , 6 ],
         [4 , 9 , 15, 22],
         [8 , 17, 27, 38]])

        >>> y = paddle.cumsum(data, dtype='float64')
        >>> assert y.dtype == paddle.float64
TFr   r   r   rr   )r   r   r   r   r   r   r   r   cumsum )r   rx   r   r   r   r   r2   r*   r-   r   r  r&   r%   r(   r   copyro  r1   )
rr   rq   r   r   r   flatten
locals_varr   rq  	_cum_sum_s
             rt   r  r  G  s   z |}77LLKKLLLL	
 
 Q A*5177eQA<D}}QgueEE 	 	
 	1cHx0X]]_
#))+ID"t , &h/	"6""rv   c                2   Uc  SnOSnUb_  [        U[        R                  R                  [        R                  45      (       d  [        U5      nU R                  U:w  a  [        X5      n [        5       (       a  Uc  Sn[        R                  " XUSS5      $ g)
Inplace version of ``cumprod`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_cumprod`.
NTFr   )rg   r+   r   VarTyper   r*   r   r3   r,   r   cumsum_)rr   rq   r   r   r  s        rt   r  r    s     |%$,,"6"6!FGG.u5E77eaA<D~~awu== rv   c                D   Uc*  SnU R                  S[        U R                  5      S-
  5      n [        USSS/S5        [	        U[
        R                  R                  [
        R                  45      (       d  [        U5      n[        5       (       a  [        R                  " XU5      $ [        U S/ S	QS5        [        U S[        S5        [!        S0 [#        5       D6nUR%                  U R&                  5      nUR%                  SS
9nUR)                  SSU 0XVS.XS.S9  XV4$ )aA  
The cumulative max of the elements along a given axis.

Note:
    The first element of the result is the same as the first element of the input.

Args:
    x (Tensor): The input tensor needed to be cummaxed.
    axis (int, optional): The dimension to accumulate along. -1 means the last dimension. The default (None) is to compute the cummax over the flattened array.
    dtype (str|paddle.dtype|np.dtype, optional): The data type of the indices tensor, can be int32, int64. The default value is int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor), The result of cummax operation. The dtype of cummax result is same with input x.

    indices (Tensor), The corresponding index results of cummax operation.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> data = paddle.to_tensor([-1, 5, 0, -2, -3, 2])
        >>> data = paddle.reshape(data, (2, 3))

        >>> value, indices = paddle.cummax(data)
        >>> value
        Tensor(shape=[6], dtype=int64, place=Place(cpu), stop_gradient=True,
        [-1,  5,  5,  5,  5,  5])
        >>> indices
        Tensor(shape=[6], dtype=int64, place=Place(cpu), stop_gradient=True,
        [0, 1, 1, 1, 1, 1])

        >>> value, indices = paddle.cummax(data, axis=0)
        >>> value
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[-1,  5,  0],
         [-1,  5,  2]])
        >>> indices
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[0, 0, 0],
         [0, 0, 1]])

        >>> value, indices = paddle.cummax(data, axis=-1)
        >>> value
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[-1,  5,  5],
         [-2, -2,  2]])
        >>> indices
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[0, 1, 1],
         [0, 0, 2]])

        >>> value, indices = paddle.cummax(data, dtype='int64')
        >>> assert indices.dtype == paddle.int64
r   r   r/   r   r   r   cummaxrr   r   r   r   r   r   r   indicesrq   r   r   )r  )r  rn   ro   r$   rg   r+   r   r   r   r*   r-   r   r  r&   r%   r(   r)   r   r   r   r   rr   rq   r   r   r   r   r  s          rt   r  r    s   | |IIaQWW)*w' 2H=edll22DMMBCC*51}}Qe,, 4		
 	1cHx02277@;;';J840	 	 	
 |rv   c                D   Uc*  SnU R                  S[        U R                  5      S-
  5      n [        USSS/S5        [	        U[
        R                  R                  [
        R                  45      (       d  [        U5      n[        5       (       a  [        R                  " XU5      $ [        U S/ S	QS5        [        U S[        S5        [!        S0 [#        5       D6nUR%                  U R&                  5      nUR%                  SS
9nUR)                  SSU 0XVS.XS.S9  XV4$ )a@  
The cumulative min of the elements along a given axis.

Note:
    The first element of the result is the same as the first element of the input.

Args:
    x (Tensor): The input tensor needed to be cummined.
    axis (int, optional): The dimension to accumulate along. -1 means the last dimension. The default (None) is to compute the cummin over the flattened array.
    dtype (str|paddle.dtype|np.dtype, optional): The data type of the indices tensor, can be int32, int64. The default value is int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor), The result of cummin operation. The dtype of cummin result is same with input x.

    indices (Tensor), The corresponding index results of cummin operation.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> data = paddle.to_tensor([-1, 5, 0, -2, -3, 2])
        >>> data = paddle.reshape(data, (2, 3))

        >>> value, indices = paddle.cummin(data)
        >>> value
        Tensor(shape=[6], dtype=int64, place=Place(cpu), stop_gradient=True,
        [-1, -1, -1, -2, -3, -3])
        >>> indices
        Tensor(shape=[6], dtype=int64, place=Place(cpu), stop_gradient=True,
        [0, 0, 0, 3, 4, 4])

        >>> value, indices = paddle.cummin(data, axis=0)
        >>> value
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[-1,  5,  0],
         [-2, -3,  0]])
        >>> indices
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[0, 0, 0],
         [1, 1, 0]])

        >>> value, indices = paddle.cummin(data, axis=-1)
        >>> value
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[-1, -1, -1],
         [-2, -3, -3]])
        >>> indices
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[0, 0, 0],
         [0, 1, 1]])

        >>> value, indices = paddle.cummin(data, dtype='int64')
        >>> assert indices.dtype == paddle.int64
r   r   r/   r   r   r   cumminrr   r  r   r  r  r   )r
  )r  rn   ro   r$   rg   r+   r   r   r   r*   r-   r   r
  r&   r%   r(   r)   r   r   r   r   r  s          rt   r
  r
  +  s   z |IIaQWW)*w' 2H=edll22DMMBCC*51}}Qe,, 4		
 	1cHx02277@;;';J840	 	 	
 |rv   c                j   Uc  SnOSnUb$  U R                   [        U5      :w  a  [        X5      n [        5       (       a  Uc  Sn[        R
                  " XUSS5      $ [        U S/ SQS5        [        S0 [        5       D6nUR                  U R                   5      nUR                  SSU 0SU0XS	.S
9  U$ )a	  
The logarithm of the cumulative summation of the exponentiation of the elements along a given axis.

For summation index j given by `axis` and other indices i, the result is

.. math::

    logcumsumexp(x)_{ij} = log \sum_{i=0}^{j}exp(x_{ij})

Note:
    The first element of the result is the same as the first element of the input.

Args:
    x (Tensor): The input tensor, with data type float32, float64, float16,
        bfloat16, uint8, int8, int16, int32, int64
    axis (int, optional): The dimension to do the operation along. -1 means the last dimension. The default (None) is to compute the cumsum over the flattened array.
    dtype (str|core.VarDesc.VarType|core.DataType|np.dtype, optional): The data type of the output tensor, can be float16, float32, float64. If specified, the input tensor is casted to dtype before the operation is performed. This is useful for preventing data type overflows. The default value is None.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, the result of logcumsumexp operator (integer input types are autocasted into float32).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> data = paddle.arange(12, dtype='float64')
        >>> data = paddle.reshape(data, (3, 4))

        >>> y = paddle.logcumsumexp(data)
        >>> y
        Tensor(shape=[12], dtype=float64, place=Place(cpu), stop_gradient=True,
        [0.         , 1.31326169 , 2.40760596 , 3.44018970 , 4.45191440 ,
         5.45619332 , 6.45776285 , 7.45833963 , 8.45855173 , 9.45862974 ,
         10.45865844, 11.45866900])

        >>> y = paddle.logcumsumexp(data, axis=0)
        >>> y
        Tensor(shape=[3, 4], dtype=float64, place=Place(cpu), stop_gradient=True,
        [[0.         , 1.         , 2.         , 3.         ],
         [4.01814993 , 5.01814993 , 6.01814993 , 7.01814993 ],
         [8.01847930 , 9.01847930 , 10.01847930, 11.01847930]])

        >>> y = paddle.logcumsumexp(data, axis=-1)
        >>> y
        Tensor(shape=[3, 4], dtype=float64, place=Place(cpu), stop_gradient=True,
        [[0.         , 1.31326169 , 2.40760596 , 3.44018970 ],
         [4.         , 5.31326169 , 6.40760596 , 7.44018970 ],
         [8.         , 9.31326169 , 10.40760596, 11.44018970]])

        >>> y = paddle.logcumsumexp(data, dtype='float64')
        >>> assert y.dtype == paddle.float64
TFr   rr   	r   r   r   r   r   r   r   r   r   logcumsumexpr   r   )rq   r  r   )r  )r   r*   r2   r-   r   r  r&   r)   r   r   r   )rr   rq   r   r   r  r   r   s          rt   r  r    s    x |QWW(B5(IIN<D""1GUEBB 
 	
" 8vx877@8CL4	 	 	
 
rv   )r   r   r   c               @   Uc*  SnU R                  S[        U R                  5      S-
  5      n Ub_  [        U[        R
                  R                  [        R                  45      (       d  [        U5      nU R                  U:w  a  [        X5      n [        5       (       a  [        R                  " XSSUS9$ [        U S/ SQS5        [        US	[         S5        [#        S0 [%        5       D6nUR'                  U R                  5      nUR)                  SS
U 0SU0S	U0S9  U$ )a	  
Compute the cumulative product of the input tensor x along a given dimension dim.

.. note::
    The first element of the result is the same as the first element of the input.
    Alias Support: The parameter name ``input`` can be used as an alias for ``x``.

Args:
    x (Tensor): the input tensor need to be cumproded.
    dim (int|None, optional): the dimension along which the input tensor will be accumulated. It need to be in the range of [-x.rank, x.rank) or None,
                where x.rank means the dimensions of the input tensor x and -1 means the last dimension. The default (None) is to compute the cumprod over the flattened array.
    dtype (str|core.VarDesc.VarType|core.DataType|np.dtype, optional): The data type of the output tensor, can be bfloat16, float16, float32, float64, int32, int64,
                complex64, complex128. If specified, the input tensor is casted to dtype before the operation is performed.
                This is useful for preventing data type overflows. The default value is None.
    out (Tensor|None, optional): The output tensor. Default: None.
    name (str|None, optional): Name for the operation (optional, default is None). For more information,
                please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, the result of cumprod operator.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> data = paddle.arange(12)
        >>> data = paddle.reshape(data, (3, 4))
        >>> data
        Tensor(shape=[3, 4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[0 , 1 , 2 , 3 ],
         [4 , 5 , 6 , 7 ],
         [8 , 9 , 10, 11]])

        >>> y = paddle.cumprod(data, dim=0)
        >>> y
        Tensor(shape=[3, 4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[0  , 1  , 2  , 3  ],
         [0  , 5  , 12 , 21 ],
         [0  , 45 , 120, 231]])

        >>> y = paddle.cumprod(data, dim=-1)
        >>> y
        Tensor(shape=[3, 4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[0   , 0   , 0   , 0   ],
         [4   , 20  , 120 , 840 ],
         [8   , 72  , 720 , 7920]])

        >>> y = paddle.cumprod(data, dim=1, dtype='float64')
        >>> y
        Tensor(shape=[3, 4], dtype=float64, place=Place(cpu), stop_gradient=True,
        [[0.   , 0.   , 0.   , 0.   ],
         [4.   , 20.  , 120. , 840. ],
         [8.   , 72.  , 720. , 7920.]])

        >>> assert y.dtype == paddle.float64

r   r   r/   Fr   rr   r   r   r   r   r   r   r   r   cumprodr  r   r   r   )r  )r  rn   ro   rg   r+   r   r   r   r*   r   r2   r-   r   r  r&   r%   rk   r)   r   r   r   )rr   r  r   r   r   r   s         rt   r  r    s   F {IIaQWW)*%$,,"6"6!FGG.u5E77eQA~~aeU<< 	 	
 	3sI.3&(377@8CL#,	 	 	
 
rv   c                |   Uc0  Sn[         R                  " U S[        U R                  5      S-
  5      n Ub_  [	        U[
        R                  R                  [
        R                  45      (       d  [        U5      nU R                  U:w  a  [        X5      n [        5       (       a  [         R                  " XSS5      $ g)r  Nr   r   r/   F)r   flatten_rn   ro   rg   r+   r   r   r   r*   r   r3   r,   cumprod_)rr   r  r   r   s       rt   r  r  V  s     {OOAq#agg,"23%$,,"6"6!FGG.u5E77eaAque44 rv   c           	        Ub4  [        US/ SQS5        U R                  [        U5      :w  a  [        X5      n [        R
                  " U5      (       a  UR                  S/:X  a  U $ [        X5      u  pa[        5       (       a  [        R                  " XX&US9$ [        S0 [        5       D6n[        U S/ SQS5        UR                  UR                  5       S9nUR!                  SS	U 0S
U0XUS.S9  U$ )a	  
Compute the product of tensor elements over the given axis.

.. note::
    Alias Support: The parameter name ``input`` can be used as an alias for ``x``, and ``dim`` can be used as an alias for ``axis``.
    For example, ``prod(input=tensor_x, dim=1, ...)`` is equivalent to ``prod(x=tensor_x, axis=1, ...)``.

Args:
    x (Tensor): The input tensor, its data type should be bfloat16, float16, float32, float64, int32, int64, complex64, complex128.
        alias: ``input``.
    axis (int|list|tuple|None, optional): The axis along which the product is computed. If :attr:`None`,
        multiply all elements of `x` and return a Tensor with a single element,
        otherwise must be in the range :math:`[-x.ndim, x.ndim)`. If :math:`axis[i]<0`,
        the axis to reduce is :math:`x.ndim + axis[i]`. Default is None.
        alias: ``dim``.
    keepdim (bool, optional): Whether to reserve the reduced dimension in the output Tensor. The result
        tensor will have one fewer dimension than the input unless `keepdim` is true. Default is False.
    dtype (str|core.VarDesc.VarType|core.DataType|np.dtype, optional): The desired date type of returned tensor, can be bfloat16,
        float16, float32, float64, int32, int64. If specified, the input tensor is casted to dtype before
        operator performed. This is very useful for avoiding data type overflows. The default value is None,
        the dtype of output is the same as input Tensor `x`.
    out (Tensor|None, optional): The output tensor. Default: None.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, result of product on the specified dim of input tensor.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> # the axis is a int element
        >>> x = paddle.to_tensor([[0.2, 0.3, 0.5, 0.9],
        ...                       [0.1, 0.2, 0.6, 0.7]])
        >>> out1 = paddle.prod(x)
        >>> out1
        Tensor(shape=[], dtype=float32, place=Place(cpu), stop_gradient=True,
        0.00022680)

        >>> out2 = paddle.prod(x, -1)
        >>> out2
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.02700000, 0.00840000])

        >>> out3 = paddle.prod(x, 0)
        >>> out3
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.02000000, 0.06000000, 0.30000001, 0.63000000])

        >>> out4 = paddle.prod(x, 0, keepdim=True)
        >>> out4
        Tensor(shape=[1, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[0.02000000, 0.06000000, 0.30000001, 0.63000000]])

        >>> out5 = paddle.prod(x, 0, dtype='int64')
        >>> out5
        Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [0, 0, 0, 0])

        >>> # the axis is list
        >>> y = paddle.to_tensor([[[1.0, 2.0], [3.0, 4.0]],
        ...                         [[5.0, 6.0], [7.0, 8.0]]])
        >>> out6 = paddle.prod(y, [0, 1])
        >>> out6
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [105., 384.])

        >>> out7 = paddle.prod(y, (1, 2))
        >>> out7
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [24.  , 1680.])

r   )r   r   r   r   r   r   r   r   r  r   r   reduce_prodrX  r   r   r   r  r   )r  )r$   r   r*   r2   rx   	is_tensorro   r}   r-   r   r  r)   r   r&   r   rc  r   )rr   rq   rT  r   r   r   rs   r   s           rt   r  r  n  s   f 	 	
 77077QA $**"33D<J{{1GSAA7fh7 	 	
 77$$& 8 
 	8CL:N	 	 	
 
rv   c                .    [         R                  " U 5      $ )z
Inplace version of ``tanh`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_tanh`.
)r   tanh_r   s     rt   r  r    s     <<?rv   c           	     *   [        5       (       a  [        R                  " X5      $ [        U S/ SQS5        [	        5       (       a  [        R                  " X5        U $ [        S0 [        5       D6nUR                  SSU /0SU /0S[        U5      0S9  U $ )	a  
The API is usually used for control flow to increment the data of :attr:`x` by an amount :attr:`value`.
Notice that the number of elements in :attr:`x` must be equal to 1.

Args:
    x (Tensor): A tensor that must always contain only one element, its data type supports float32, float64, int32 and int64.
    value (float, optional): The amount to increment the data of :attr:`x`. Default: 1.0.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, the elementwise-incremented tensor with the same shape and data type as :attr:`x`.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> data = paddle.zeros(shape=[1], dtype='float32')
        >>> counter = paddle.increment(data)
        >>> counter
        Tensor(shape=[1], dtype=float32, place=Place(cpu), stop_gradient=True,
        [1.])

rr   r  	incrementr   r   stepr   )r  )	r,   r   
increment_r&   r.   r)   r   r   r   )rr   valuer   r   s       rt   r  r    s    2   **	38+ }}!#5FH5!:QCL5<(	 	 	
 rv   c                     [        U 5      S:X  a  / $ [        U 5      S:X  a  [        U S   5      $ [        U S   5      nU SS  H  n[        X5      nM     U$ )a  
The function returns the shape of doing operation with broadcasting on tensors of shape list.

Note:
    If you want know more about broadcasting, please refer to `Introduction to Tensor`_ .

    .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

Args:
    *shapes (list[int]|tuple[int]): A shape list of multiple tensors.


Returns:
    list[int], the result shape.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> shape = paddle.broadcast_shapes([2, 1, 3], [1, 3, 1])
        >>> shape
        [2, 3, 3]

        >>> # shape = paddle.broadcast_shapes([2, 1, 3], [3, 3, 1])
        >>> # ValueError (terminated with error message).

        >>> shape = paddle.broadcast_shapes([5, 1, 3], [1, 4, 1], [1, 1, 3])
        >>> shape
        [5, 4, 3]

        >>> # shape = paddle.broadcast_shapes([5, 1, 3], [1, 4, 1], [1, 2, 3])
        >>> # ValueError (terminated with error message).

r   r/   N)rn   rh   r   )shapescurrent_shape
next_shapes      rt   broadcast_shapesr"  .  s]    H 6{a		V	F1IVAY *J+MFM %rv   c                .    [         R                  " X5      $ )a  
The function returns the shape of doing operation with broadcasting on tensors of x_shape and y_shape.

Note:
    If you want know more about broadcasting, please refer to `Introduction to Tensor`_ .

    .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

Args:
    x_shape (list[int]|tuple[int]): A shape of tensor.
    y_shape (list[int]|tuple[int]): A shape of tensor.


Returns:
    list[int], the result shape.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> shape = paddle.broadcast_shape([2, 1, 3], [1, 3, 1])
        >>> shape
        [2, 3, 3]

        >>> # shape = paddle.broadcast_shape([2, 1, 3], [3, 3, 1])
        >>> # ValueError (terminated with error message).

)r+   r   )r  r  s     rt   r   r   ]  s    B 11rv   c                    [        5       (       a  [        R                  " U 5      $ [        U S/ SQS5        [	        S0 [        5       D6nUR                  UR                  5       S9nUR                  SSU 0SU/0S9  U$ )	av  
This function computes the conjugate of the Tensor elementwisely.

Args:
    x (Tensor): The input Tensor which hold the complex numbers.
        Optional data types are: bfloat16, float16, complex64, complex128, float32, float64, int32 or int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): The conjugate of input. The shape and data type is the same with input. If the elements of tensor is real type such as float32, float64, int32 or int64, the out is the same with input.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> data = paddle.to_tensor([[1+1j, 2+2j, 3+3j], [4+4j, 5+5j, 6+6j]])
        >>> data
        Tensor(shape=[2, 3], dtype=complex64, place=Place(cpu), stop_gradient=True,
        [[(1+1j), (2+2j), (3+3j)],
         [(4+4j), (5+5j), (6+6j)]])

        >>> conj_data = paddle.conj(data)
        >>> conj_data
        Tensor(shape=[2, 3], dtype=complex64, place=Place(cpu), stop_gradient=True,
        [[(1-1j), (2-2j), (3-3j)],
         [(4-4j), (5-5j), (6-6j)]])

rr   r  conjr   r   r   r   )r%  )	r-   r   r%  r&   r)   r   r   rc  r   rr   r   r   r   s       rt   r%  r%    s    < {{1~ 	 	
  0vx077$$& 8 
 	fc1Xu~N
rv   c                    [        5       (       a  [        R                  " U 5      $ [        U S/ SQS5        [	        S0 [        5       D6nUR                  U R                  5      nUR                  SSU 0SU0S9  U$ )a#  
Calculates the logarithm of the absolute value of the gamma function elementwisely.

Args:
    x (Tensor): Input Tensor. Must be one of the following types: float16, float32, float64, bfloat16.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, The values of the logarithm of the absolute value of the gamma at the given tensor x.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.arange(1.5, 4.5, 0.5)
        >>> out = paddle.gammaln(x)
        >>> print(out)
        Tensor(shape=[6], dtype=float32, place=Place(cpu), stop_gradient=True,
            [-0.12078224,  0.        ,  0.28468287,  0.69314718,  1.20097363,
                1.79175949])
rr   )r   r   r   r   gammalnr   r   )r(  )	r-   r   r(  r&   r)   r   r   r   r   r&  s       rt   r(  r(    su    . ~~a   sA9	
 3&(377@ia5#,O
rv   c                N    [        5       (       a  [        R                  " U 5      $ g)z
Inplace version of ``gammaln`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_gammaln`.
N)r,   r   gammaln_r   s     rt   r*  r*    !     q!! rv   c                    [        5       (       a  [        R                  " U 5      $ [        U S/ SQS5        [	        S0 [        5       D6nUR                  U R                  5      nUR                  SSU 0SU0S9  U$ )a  
Calculates the digamma of the given input tensor, element-wise.

.. math::
    Out = \Psi(x) = \frac{ \Gamma^{'}(x) }{ \Gamma(x) }

Args:
    x (Tensor): Input Tensor. Must be one of the following types: bfloat16, float16, float32,
        float64, uint8, int8, int16, int32, int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
    Tensor, the digamma of the input Tensor, the shape and data type is the same with input
        (integer types are autocasted into float32).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> data = paddle.to_tensor([[1, 1.5], [0, -2.2]], dtype='float32')
        >>> res = paddle.digamma(data)
        >>> res
        Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[-0.57721591,  0.03648996],
         [ nan       ,  5.32286835]])
rr   r  digammar   r   r   )r-  )	r-   r   r-  r&   r)   r   r   r   r   r&  s       rt   r-  r-    s{    8 ~~a   
 	
  3&(377@ia5#,O
rv   c                N    [        5       (       a  [        R                  " U 5      $ g)z
Inplace version of ``digamma`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_digamma`.
N)r,   r   digamma_r   s     rt   r/  r/    r+  rv   c                   [        U [        5      (       dO  [        R                  " [        R                  " U [        R
                  " U 5      5      5      (       d  [        S5      e[        U [        5      (       dO  [        R                  " [        R                  " U[        R
                  " U5      5      5      (       d  [        S5      e[        5       (       a  [        R                  " X5      $ [        U SSS/S5        [        USSS/S5        [        S0 [        5       D6nUR                  U R                  5      nUR                  SXS.S	U0S
9  U$ )a  
Computes the regularized upper incomplete gamma function.

.. math:: Q(x, y) = \frac{1}{\Gamma(x)} \int_{y}^{\infty} t^{x-1} e^{-t} dt

Args:
    x (Tensor): The non-negative argument Tensor. Must be one of the following types: float32, float64.
    y (Tensor): The positive parameter Tensor. Must be one of the following types: float32, float64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, the gammaincc of the input Tensor.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([0.5, 0.5, 0.5, 0.5, 0.5], dtype="float32")
        >>> y = paddle.to_tensor([0, 1, 10, 100, 1000], dtype="float32")
        >>> out = paddle.gammaincc(x, y)
        >>> print(out)
        Tensor(shape=[5], dtype=float32, place=Place(cpu), stop_gradient=True,
            [1.        , 0.15729916, 0.00000774, 0.        , 0.        ])
z8The input argument x must be greater than or equal to 0.z8The input argument y must be greater than or equal to 0.rr   r   r   	gammainccr   r   r   r   )r1  )rg   r   rx   r   greater_equalrS  r   r-   r   r1  r&   r)   r   r   r   r   r  s        rt   r1  r1  '  s'   4 a

Q 1 1! 45) ) F
 	
 a

Q 1 1! 45) ) F
 	
 %% C)Y)?M C)Y)?M5FH577@1%5s| 	 	
 
rv   c                N    [        5       (       a  [        R                  " X5      $ g)z
Inplace version of ``gammaincc`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_gammaincc`.
N)r,   r   
gammaincc_r   s      rt   r4  r4  Z  s#       && rv   c                4    S[         R                  " X5      -
  $ )a  
Computes the regularized lower incomplete gamma function.

.. math:: P(x, y) = \frac{1}{\Gamma(x)} \int_{0}^{y} t^{x-1} e^{-t} dt

Args:
    x (Tensor): The non-negative argument Tensor. Must be one of the following types: float32, float64.
    y (Tensor): The positive parameter Tensor. Must be one of the following types: float32, float64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, the gammainc of the input Tensor.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([0.5, 0.5, 0.5, 0.5, 0.5], dtype="float32")
        >>> y = paddle.to_tensor([0, 1, 10, 100, 1000], dtype="float32")
        >>> out = paddle.gammainc(x, y)
        >>> print(out)
        Tensor(shape=[5], dtype=float32, place=Place(cpu), stop_gradient=True,
            [0.        , 0.84270084, 0.99999225, 1.        , 1.        ])
r/   )rx   r1  r   s      rt   gammaincr6  d  s    4 v%%%rv   c                    [         R                  " X5      R                  [         R                  " U S5      5      R	                  [         R                  " U S5      5      $ )z
Inplace version of ``gammainc`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_gammainc`.
            ?)rx   r4  r  r:  r   r   s      rt   	gammainc_r:    sE     	!	6##At,	-	fq#&	'rv   c                    [        5       (       a  [        R                  " U 5      $ [        U S/ SQS5        [	        S0 [        5       D6nUR                  U R                  5      nUR                  SSU 0SU0S9  U$ )a  
Calculates the lgamma of the given input tensor, element-wise.

This operator performs elementwise lgamma for input $X$.
:math:`out = log\Gamma(x)`


Args:
    x (Tensor): Input Tensor. Must be one of the following types: bfloat16, float16, float32, float64,
        uint8, int8, int16, int32, int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, the lgamma of the input Tensor, the shape and data type is the same with input
        (integer types are autocasted into float32).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([-0.4, -0.2, 0.1, 0.3])
        >>> out = paddle.lgamma(x)
        >>> out
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [1.31452453, 1.76149762, 2.25271273, 1.09579790])
rr   r  lgammar   r   r   )r<  )	r-   r   r<  r&   r)   r   r   r   r   r&  s       rt   r<  r<    s{    8 }}Q 
 	
  2277@hQx%N
rv   c                N    [        5       (       a  [        R                  " U 5      $ g)z
Inplace version of ``lgamma`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_lgamma`.
N)r,   r   lgamma_r   s     rt   r>  r>    s!     ~~a   rv   c                N   US:  d   SU S35       eSU-  US-
  -  [         R                  " [         R                  5      -  nS[        R                  " SU-
  SSU R
                  S9-  n[        R                  " [        R                  " U R                  S5      U-   5      SS9U-   $ )	a  
This function computes the log of multivariate gamma, also sometimes called the generalized gamma.

Args:
    x (Tensor): Input Tensor. Must be one of the following types: float16, float32, float64, uint16.
    p (int): The dimension of the space of integration.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): The values of the log multivariate gamma at the given tensor x.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([2.5, 3.5, 4, 6.5, 7.8, 10.23, 34.25])
        >>> p = 2
        >>> out = paddle.multigammaln(x, p)
        >>> print(out)
        Tensor(shape=[7], dtype=float32, place=Place(cpu), stop_gradient=True,
            [0.85704780  , 2.46648574  , 3.56509781  , 11.02241898 , 15.84497833 ,
                26.09257698 , 170.68318176])
r/   <The p must be greater than or equal to 1, But received p is rn        ?      ?startendr  r   r   rq   )	r  r   pirx   aranger   r   r<  	unsqueezerr   r  r   cbs        rt   multigammalnrM    s    2 6 
FqcM6 	qAETXXdgg..Afmm1q5qqHHA::fmmAKKOa$78rBQFFrv   c                   US:  d   SU S35       eSU-  US-
  -  [         R                  " [         R                  5      -  n[        R                  " X0R
                  S9nS[        R                  " SU-
  SSU R
                  S9-  n[        R                  " U R                  S5      U-   R                  5       R                  S5      R                  U5      U 5        U $ )	z
Inplace version of ``multigammaln_`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_multigammaln`.
r/   r@  rn  rA  r   rB  rC  r   )r  r   rG  rx   r  r   rH  assignrI  r>  r   r   rJ  s        rt   multigammaln_rP    s     6 
FqcM6 	qAETXXdgg..A''*Afmm1q5qqHHA
MM1;;r?Q&//155b9>>qA1EHrv   c           	         [        U SSSSUS9$ )a.  
This function computes the negative of the Tensor elementwisely.

Args:
    x (Tensor): Input of neg operator, an N-D Tensor, with data type bfloat16, float16, float32, float64, int8, int16, int32,
        int64, uint8, complex64, complex128.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): The negative of input Tensor. The shape and data type are the same with input Tensor.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([-0.4, -0.2, 0.1, 0.3])
        >>> out = paddle.neg(x)
        >>> out
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [ 0.40000001,  0.20000000, -0.10000000, -0.30000001])
r8  r   TNr   r   r   r   r   r   r   s     rt   negrS    s    0 	C$Dt rv   c                (    U R                  SSSSUS9$ )z}
Inplace version of ``neg`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_neg`.
r8  r   TNrR  )r   r   s     rt   neg_rU    s%     88tD   rv   c                X    U R                   [        R                  :X  a  [        S5      eU $ )a  
Returns the input Tensor as it is. This is used in `Tensor.__pos__`, applying the
unary `+` operator to the tensor.

.. math::
    Out = +X

Args:
    x (Tensor): The input tensor. The tensor cannot be of type bool.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: A tensor with the same shape and data type as the input tensor. The returned tensor
            is the same.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> x = paddle.to_tensor([-1, 0, 1])
        >>> out = paddle.positive(x)
        >>> print(out)
        Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [-1,  0,  1])
z4The `+` operator, on a bool tensor is not supported.r   rx   r   rl   r   s     rt   positiverX  &  s%    8 	ww&++NOOHrv   c                Z    U R                   [        R                  :X  a  [        S5      eU * $ )a  
Returns the negated version of the input Tensor. This is used in `Tensor.__neg__`, applying the
unary `-` operator to the tensor.

.. math::
    Out = -X

Args:
    x (Tensor): The input tensor. The tensor cannot be of type bool.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: A tensor with the same shape and data type as the input tensor. The returned tensor
            is the negative.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> x = paddle.to_tensor([-1, 0, 1])
        >>> out = paddle.negative(x)
        >>> print(out)
        Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [1,  0,  -1])
z4The `-` operator, on a bool tensor is not supported.rW  r   s     rt   negativerZ  G  s'    8 	ww&++NOO2Irv   c                    [        U R                  5      n[        UR                  5      n[        5       (       aa  U nUnX4:w  aB  [        R                  " X45      n[        R
                  " XW5      n[        R
                  " Xg5      n[        R                  " XV5      $ [        U S/ SQS5        [        US/ SQS5        [        S	0 [        5       D6nXS.n	UR                  U R                  S9n
UR                  SU	SU
0S9  U
$ )
a  
Element-wise arctangent of x/y with consideration of the quadrant.

Equation:
    .. math::

        atan2(x,y)=\left\{\begin{matrix}
        & tan^{-1}(\frac{x}{y}) & y > 0 \\
        & tan^{-1}(\frac{x}{y}) + \pi & x>=0, y < 0 \\
        & tan^{-1}(\frac{x}{y}) - \pi & x<0, y < 0 \\
        & +\frac{\pi}{2} & x>0, y = 0 \\
        & -\frac{\pi}{2} & x<0, y = 0 \\
        &\text{undefined} & x=0, y = 0
        \end{matrix}\right.

Args:
    x (Tensor): An N-D Tensor, the data type is int32, int64, float16, float32, float64.
    y (Tensor): An N-D Tensor, must have the same type as `x`.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): An N-D Tensor, the shape and data type is the same with input (The output data type is float64 when the input data type is int).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([-1, +1, +1, -1]).astype('float32')
        >>> x
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [-1,  1,  1, -1])

        >>> y = paddle.to_tensor([-1, -1, +1, +1]).astype('float32')
        >>> y
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [-1,  -1,  1, 1])

        >>> out = paddle.atan2(x, y)
        >>> out
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [-2.35619450,  2.35619450,  0.78539819, -0.78539819])

rr   r  atan2r   )X1X2r   r   r   )r\  )rh   ro   r-   rx   r   broadcast_tor   r\  r&   r)   r   r   r   r   )rr   r   r   r  r  broadcast_xbroadcast_yr   r   r   r   s              rt   r\  r\  h  s    \ 177mG177mG$44WFO --kKK --kKK||K55 ?		
 	!?		
 11#77agg7FgfuclK
rv   c                   Uc  Sn[        5       (       a  [        R                  " X5      $ [        U S/ SQS5        [	        S	0 [        5       D6nUR                  U R                  5      nUR                  SSU 0SU0SU0S9  U$ )
a^  
This function generates a new tensor with the logit of the elements of input x. x is clamped to [eps, 1-eps] when eps is not zero. When eps is zero and x < 0 or x > 1, the function will yields NaN.

.. math::

    logit(x) = ln(\frac{x}{1 - x})

where

.. math::

    x_i=
        \left\{\begin{array}{rcl}
            x_i & &\text{if } eps == Default \\
            eps & &\text{if } x_i < eps \\
            x_i & &\text{if } eps <= x_i <= 1-eps \\
            1-eps & &\text{if } x_i > 1-eps
        \end{array}\right.

Args:
    x (Tensor): The input Tensor with data type bfloat16, float16, float32, float64,
        uint8, int8, int16, int32, int64.
    eps (float|None, optional):  the epsilon for input clamp bound. Default is None.
    name (str|None, optional): Name for the operation (optional, default is None).
        For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out(Tensor): A Tensor with the same data type and shape as ``x``
        (integer types are autocasted into float32).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([0.2635, 0.0106, 0.2780, 0.2097, 0.8095])
        >>> out1 = paddle.logit(x)
        >>> out1
        Tensor(shape=[5], dtype=float32, place=Place(cpu), stop_gradient=True,
        [-1.02785587, -4.53624487, -0.95440406, -1.32673466,  1.44676447])

r   rr   r   logitr   r   epsr   )rc  )	r-   r   rc  r&   r)   r   r   r   r   )rr   rd  r   r   r   s        rt   rc  rc    s    Z {||A## 
 	
  1177@8CL#,	 	 	
 
rv   c                X    Uc  Sn[        5       (       a  [        R                  " X5      $ g)z
Inplace version of ``logit`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_logit`.
Nr   )r,   r   logit_)rr   rd  r   s      rt   rf  rf    s+     {}}Q$$ rv   c                   [        U[        5      (       a  [        R                  " / X R                  S9n[        5       (       a  [        R                  " XU5      $ [        U S/ SQS5        [        US/ SQS5        [        US/ SQS5        [        S0 [        5       D6nXUS.nUR                  U R                  S9nUR                  SUS	U0S
9  U$ )ah  
Does a linear interpolation between x and y based on weight.

Equation:
    .. math::

        lerp(x, y, weight) = x + weight * (y - x).

Args:
    x (Tensor): An N-D Tensor with starting points, the data type is bfloat16, float16, float32, float64.
    y (Tensor): An N-D Tensor with ending points, the data type is bfloat16, float16, float32, float64.
    weight (float|Tensor): The weight for the interpolation formula. When weight is Tensor, the data type is bfloat16, float16, float32, float64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): An N-D Tensor, the shape and data type is the same with input.

Example:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.arange(1., 5., dtype='float32')
        >>> y = paddle.empty([4], dtype='float32')
        >>> y.fill_(10.)
        >>> out = paddle.lerp(x, y, 0.5)
        >>> out
        Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [5.50000000, 6.        , 6.50000000, 7.        ])

)ro   
fill_valuer   rr   rY  lerpr   weight)r   r   Weightr   r   r   )ri  )rg   r   rx   r  r   r-   r   ri  r&   r)   r   r   r   )rr   r   rj  r   r   r   r   s          rt   ri  ri    s    D &%  2&H{{1(( s?	
 	!s?	
 	!7		
 0vx0F377agg7FfVeS\J
rv   c                   [        U R                  UR                  5      n[        US[        [        R
                  [        4S5        [        U[        5      (       a!  [        R                  " U/U R                  S9nO:[        U[        R
                  [        45      (       a  [        XBR                  5      nX@R                  :w  a  [        SU SU R                   S35      e[        R                  " XU5      $ )z
Inplace version of ``lerp`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_lerp`.
rj  ri  r   r   r   r   )r   ro   r%   r   rx   rc   r(   rg   r  r   r   r   lerp_)rr   r   rj  r   r   s        rt   rm  rm  M  s      1Ivx%!A6J&%  !!6(!'':	FV]]H5	6	6#I||<	GG,YK7abcbibiaj  kE  F
 	
 <<f%%rv   c                    [        5       (       a  [        R                  " U 5      $ [        U S/ SQS5        [	        S0 [        5       D6nUR                  U R                  S9nUR                  SSU 0SU0S9  U$ )	aL  
The inverse error function of x. Please refer to :ref:`api_paddle_erf`

    .. math::

        erfinv(erf(x)) = x.

Args:
    x (Tensor): An N-D Tensor, the data type is float16, bfloat16, float32, float64,
        uint8, int8, int16, int32, int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor), an N-D Tensor, the shape and data type is the same with input
        (integer types are autocasted into float32).

Example:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([0, 0.5, -1.], dtype="float32")
        >>> out = paddle.erfinv(x)
        >>> out
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [ 0.       , 0.47693631, -inf.     ])

rr   )	r   r   r   r   r   r   r   r   r   erfinvr   r   r   r   )ro  )	r-   r   ro  r&   r)   r   r   r   r   r&  s       rt   ro  ro  b  s~    : }}Q 
 	
  2277agg7FhQx%N
rv   c                r    [        U S[        R                  [        4S5        [        R
                  " U 5      $ )z
Inplace version of ``erfinv`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_erfinv`.
rr   ro  )r%   rx   rc   r(   r   erfinv_r   s     rt   rq  rq    s*     q#x0(;>>!rv   c                :   S[         R                  -  n[        5       (       a;  [        U R                  5      S;   a
  [        U SS9n [        R                  " XSS5      $ [        U S/ SQS	5        [        S0 [        5       D6nU n[        U R                  5      S;   aN  UR                  [        R                  S9nUR                  S
SU 0SU0U R                  [        R                  S.S9  UR                  UR                  S9nUR                  SSU0SU0SU0S9  U$ )a:  
Convert each of the elements of input x from angles in radians to degrees.

Equation:
    .. math::

        rad2deg(x)=180/ \pi * x

Args:
    x (Tensor): An N-D Tensor, the data type is float32, float64, int32, int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): An N-D Tensor, the shape and data type is the same with input (The output data type is float32 when the input data type is int).

Examples:
    .. code-block:: python

        >>> import paddle
        >>> import math

        >>> x1 = paddle.to_tensor([3.142, -3.142, 6.283, -6.283, 1.570, -1.570])
        >>> result1 = paddle.rad2deg(x1)
        >>> result1
        Tensor(shape=[6], dtype=float32, place=Place(cpu), stop_gradient=True,
        [ 180.02334595, -180.02334595,  359.98937988, -359.98937988,
          89.95437622 , -89.95437622 ])

        >>> x2 = paddle.to_tensor(math.pi/2)
        >>> result2 = paddle.rad2deg(x2)
        >>> result2
        Tensor(shape=[], dtype=float32, place=Place(cpu), stop_gradient=True,
        90.)

        >>> x3 = paddle.to_tensor(1)
        >>> result3 = paddle.rad2deg(x3)
        >>> result3
        Tensor(shape=[], dtype=float32, place=Place(cpu), stop_gradient=True,
        57.29578018)
   r   r   r   r   r   Trr   r   rad2degr2   r   r   in_dtype	out_dtyper   r   )ru  r>  rG  r-   r'   r   r2   r   r   r&   r)   r   r   rx   r   r   )rr   r   rad2deg_scaler   out_castr   s         rt   ru  ru    s&   R "%%KM!%77Qi(A||Ac488 s<i	
 3&(3!%77@@nn A H Qx)#$77H	   77hnn7M?CLM*	 	 	
 
rv   c                :   [         R                  S-  n[        5       (       a;  [        U R                  5      S;   a
  [        U SS9n [        R                  " XSS5      $ [        U S/ SQS	5        [        S0 [        5       D6nU n[        U R                  5      S;   aN  UR                  [        R                  S9nUR                  S
SU 0SU0U R                  [        R                  S.S9  UR                  UR                  S9nUR                  SSU0SU0SU0S9  U$ )aD  
Convert each of the elements of input x from degrees to angles in radians.

    .. math::

        deg2rad(x)=\pi * x / 180

Args:
    x (Tensor): An N-D Tensor, the data type is float32, float64, int32, int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): An N-D Tensor, the shape and data type is the same with input (The output data type is float32 when the input data type is int).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x1 = paddle.to_tensor([180.0, -180.0, 360.0, -360.0, 90.0, -90.0])
        >>> result1 = paddle.deg2rad(x1)
        >>> result1
        Tensor(shape=[6], dtype=float32, place=Place(cpu), stop_gradient=True,
        [3.14159274, -3.14159274,  6.28318548, -6.28318548,  1.57079637,
        -1.57079637])

        >>> x2 = paddle.to_tensor(180)
        >>> result2 = paddle.deg2rad(x2)
        >>> result2
        Tensor(shape=[], dtype=float32, place=Place(cpu), stop_gradient=True,
        3.14159274)
g     f@rt  r   r   r   Trr   r   deg2radr2   r   r   rv  r   r   )r}  ry  )rr   r   deg2rad_scaler   r{  r   s         rt   r}  r}    s&   B EEEMM!%77Qi(A||Ac488 s<i	
 3&(3!%77@@nn A H Qx)#$77H	   77hnn7M?CLM*	 	 	
 
rv   c                    [         R                  " U R                  UR                  5      n[         R                  " X5      n [         R                  " X5      n[         R                  " U 5      n [         R                  " U5      nS nS n[        5       (       a(  U" X5      (       a  U" X5      u  pU" X5      (       a  M  U $ [        U SSS/S5        [        USSS/S5        [         R                  R                  R                  XEX/5      u  pgU$ )a  
Computes the element-wise greatest common divisor (GCD) of input |x| and |y|.
Both x and y must have integer types.

Note:
    gcd(0,0)=0, gcd(0, y)=|y|

    If x.shape != y.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

Args:
    x (Tensor): An N-D Tensor, the data type is int32, int64.
    y (Tensor): An N-D Tensor, the data type is int32, int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): An N-D Tensor, the data type is the same with input.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x1 = paddle.to_tensor(12)
        >>> x2 = paddle.to_tensor(20)
        >>> paddle.gcd(x1, x2)
        Tensor(shape=[], dtype=int64, place=Place(cpu), stop_gradient=True,
        4)

        >>> x3 = paddle.arange(6)
        >>> paddle.gcd(x3, x2)
        Tensor(shape=[6], dtype=int64, place=Place(cpu), stop_gradient=True,
        [20, 1 , 2 , 1 , 4 , 5])

        >>> x4 = paddle.to_tensor(0)
        >>> paddle.gcd(x4, x2)
        Tensor(shape=[], dtype=int64, place=Place(cpu), stop_gradient=True,
        20)

        >>> paddle.gcd(x4, x4)
        Tensor(shape=[], dtype=int64, place=Place(cpu), stop_gradient=True,
        0)

        >>> x5 = paddle.to_tensor(-20)
        >>> paddle.gcd(x1, x5)
        Tensor(shape=[], dtype=int64, place=Place(cpu), stop_gradient=True,
        4)
c                4    [         R                  " US:g  5      $ Nr   rx   r
   r   s     rt   _gcd_cond_fngcd.<locals>._gcd_cond_fna      zz!q&!!rv   c           	        US:g  n[         R                  " X![         R                  " UR                  UR                  5      5      n[         R                  " X!U 5      [         R                  " U[         R
                  " X5      [         R                  " UR                  UR                  5      5      p[         R                  " X:  X5      [         R                  " X:  X5      4$ r  )rx   rB  onesro   r   modzeros)rr   r   y_not_equal_0y_safes       rt   _gcd_body_fngcd.<locals>._gcd_body_fnd  s     QmAGGQWW0MNLL1-LL

1%QWWagg.  QUA)6<<q+DEErv   rr   r   r   gcdr   )
rx   r   ro   r_  r4   r,   r&   staticnn
while_loop)rr   r   r   ro   r  r  r   _s           rt   r  r  *  s    b ""177AGG4EA%AA%A

1A

1A"F  1  %DA 1    C'7);UC C'7);UC!!,,\!P
rv   c                   [         R                  " U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[         R                  " X5      n[         R
                  " U 5      n [         R                  " U5      nS nS n[        5       (       a(  U" X5      (       a  U" X5      u  pU" X5      (       a  M  U $ g)z}
Inplace version of ``gcd`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_gcd`.
r   r   r   c                4    [         R                  " US:g  5      $ r  r  r   s     rt   r  gcd_.<locals>._gcd_cond_fn  r  rv   c                   US:H  n[         R                  " U[         R                  " UR                  UR                  5      U5      n[         R                  " U[         R
                  " UR                  UR                  5      [         R                  " X5      5      [         R                  " X U5      p[         R                  " X:  X5      [         R                  " X:  X5      4$ r  )rx   rB  r  ro   r   r  r  rM  )rr   r   	y_equal_0r  s       rt   r  gcd_.<locals>._gcd_body_fn  s     F	iQWWagg)FJLLQWWagg.

1%
 MM)*  LL%MM!&!'
 	
rv   N)rx   r   ro   r   r_  r5   r4   r,   )rr   r   r   ro   r  r  s         rt   gcd_r    s     ""177AGG4E,UG3]^_^e^e]f  gA  B
 	
 	A%AAA

1A"
& 1  %DA 1   	 rv   c                   [         R                  " X5      n[         R                  " US5      n[         R                  " U[         R                  " UR
                  UR                  5      U5      n[         R                  " U[         R                  " UR
                  UR                  5      [         R                  " X-  5      U-  5      nU$ )a  
Computes the element-wise least common multiple (LCM) of input |x| and |y|.
Both x and y must have integer types.

Note:
    lcm(0,0)=0, lcm(0, y)=0

    If x.shape != y.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

Args:
    x (Tensor): An N-D Tensor, the data type is int32, int64.
    y (Tensor): An N-D Tensor, the data type is int32, int64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): An N-D Tensor, the data type is the same with input.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x1 = paddle.to_tensor(12)
        >>> x2 = paddle.to_tensor(20)
        >>> paddle.lcm(x1, x2)
        Tensor(shape=[], dtype=int64, place=Place(cpu), stop_gradient=True,
        60)

        >>> x3 = paddle.arange(6)
        >>> paddle.lcm(x3, x2)
        Tensor(shape=[6], dtype=int64, place=Place(cpu), stop_gradient=True,
        [0, 20, 20, 60, 20, 20])

        >>> x4 = paddle.to_tensor(0)
        >>> paddle.lcm(x4, x2)
        Tensor(shape=[], dtype=int64, place=Place(cpu), stop_gradient=True,
        0)

        >>> paddle.lcm(x4, x4)
        Tensor(shape=[], dtype=int64, place=Place(cpu), stop_gradient=True,
        0)

        >>> x5 = paddle.to_tensor(-20)
        >>> paddle.lcm(x1, x5)
        Tensor(shape=[], dtype=int64, place=Place(cpu), stop_gradient=True,
        60)
r   )	rx   r  rC  rB  r  ro   r   r  r4   )rr   r   r   d	d_equal_0d_safer   s          rt   lcmr    s    b 	

1A Q"I\\)V[[!''%BAFF
,,6<<16::ae3D3NC Jrv   c                   [         R                  " X5      nUS:g  n[         R                  " XC[         R                  " UR                  UR
                  5      5      n[         R                  " U[         R                  " U R                  U5      5      R                  U5      [         R                  " UR                  UR
                  5      5      nU$ )z}
Inplace version of ``lcm`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_lcm`.
r   )rx   r  rB  r  ro   r   rM  r5   r  r	  r  )rr   r   r   r  d_not_equal_0r  r   s          rt   lcm_r    s     	

1A FM\\-FKK,IJF
--AKKN#11&9QWWagg&C
 Jrv   )rr   rq   c          
         US:  a  [        SU 35      e SS jnU" U SUUUUUS:X  a  UOSS9nUS:  a,  [        US-
  5       H  n	U" USUSSUS9nM     U" USUSSUUS9nU$ )	a  
Computes the n-th forward difference along the given axis.
The first-order differences is computed by using the following formula:

.. math::

    out[i] = x[i+1] - x[i]

Higher-order differences are computed by using paddle.diff() recursively.
The number of n supports any positive integer value.

.. note::
    Alias Support: The parameter name ``input`` can be used as an alias for ``x``, and ``dim`` can be used as an alias for ``axis``.
    For example, ``diff(input=tensor_x, dim=1, ...)`` is equivalent to ``diff(x=tensor_x, axis=1, ...)``.

Args:
    x (Tensor): The input tensor to compute the forward difference on, the data type is float16, float32, float64, bool, int32, int64.
        alias: ``input``.
    n (int, optional): The number of times to recursively compute the difference.
                        Supports any positive integer value. Default:1
    axis (int, optional): The axis to compute the difference along. Default:-1
        alias: ``dim``.
    prepend (Tensor|None, optional): The tensor to prepend to input along axis before computing the difference.
                               It's dimensions must be equivalent to that of x,
                               and its shapes must match x's shape except on axis.
    append (Tensor|None, optional): The tensor to append to input along axis before computing the difference,
                               It's dimensions must be equivalent to that of x,
                               and its shapes must match x's shape except on axis.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
    out (Tensor, optional): The output tensor. If provided, the result will be stored in this tensor.

Returns:
    Tensor: The output tensor with same dtype with x.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([1, 4, 5, 2])
        >>> out = paddle.diff(x)
        >>> out
        Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [ 3,  1, -3])

        >>> x_2 = paddle.to_tensor([1, 4, 5, 2])
        >>> out = paddle.diff(x_2, n=2)
        >>> out
        Tensor(shape=[2], dtype=int64, place=Place(cpu), stop_gradient=True,
        [ -2,  -4])

        >>> y = paddle.to_tensor([7, 9])
        >>> out = paddle.diff(x, append=y)
        >>> out
        Tensor(shape=[5], dtype=int64, place=Place(cpu), stop_gradient=True,
        [ 3,  1, -3,  5,  2])

        >>> out = paddle.diff(x, n=2, append=y)
        >>> out
        Tensor(shape=[4], dtype=int64, place=Place(cpu), stop_gradient=True,
        [-2, -4,  8, -3])

        >>> out = paddle.diff(x, n=3, append=y)
        >>> out
        Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [-2 ,  12, -11])

        >>> z = paddle.to_tensor([[1, 2, 3], [4, 5, 6]])
        >>> out = paddle.diff(z, axis=0)
        >>> out
        Tensor(shape=[1, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[3, 3, 3]])
        >>> out = paddle.diff(z, axis=1)
        >>> out
        Tensor(shape=[2, 2], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[1, 1],
         [1, 1]])
r/   z:Diff expects input to be at least one-dimensional but got Nc                   US:  a  U[        U R                  5      -   nU[        U R                  5      :  a  [        U R                  5      nUS:  a  SnU R                  nU/n[        [        U5      5       V	s/ s H  n	SPM     n
n	[	        5       (       GaE  Sn/ nUb
  Ub  X0U/nSnOUb  X0/nSnOUb  X/nSnU(       a  [
        R                  " X5      nOU nSnSnUR                  U   nUS:  a  [        R                  " U5      U   nS/nUSU4-  nUS-
  /nUSU4-  n[
        R                  " XUUU
/ 5      nS/nUSU4-  nU/nUSU4-  n[
        R                  " XUUU
/ 5      nU R                  [        R                  :X  d(  U R                  [        R                  R                  :X  a  [
        R                  " UUUS9$ [
        R                  " UUUS9$ [        U S	/ S
QS5        [!        US["        S5        [%        S0 ['        5       D6nSn/ nUb
  Ub  X0U/nSnOUb  X0/nSnOUb  X/nSnU(       a+  UR)                  U5      nUR+                  SSU0SU/0SU0S9  OU nUR                  U   nSU0nS/nUS-
  /nUUS'   UUS'   UR)                  U5      nUR+                  SSU0USU0S9  SU0nS/nU/nUUS'   UUS'   UR)                  U5      nUR+                  SSU0USU0S9  U[        R                  :X  a)  UR)                  U5      nUR+                  SUUS.SU0S9  U$ [        R,                  R.                  R                  UU5      nU$ s  sn	f )Nr   r/   FTr  startsendsr   rr   )r   r   r   r   r   r   diffrq   concatr   r   r   axesslicer  r   logical_xorr   r   )r  )rn   ro   r   rj   r-   r   r  rx   r  r   r+   r   BOOLr  r   r&   r%   rk   r)   r   r   r   tensorr  )rr   nrq   prependappendr   r   r   r  rr  infer_flagshas_pend
input_list	new_inputattrs_1attrs_2dim_lenstarts_1ends_1input_frontstarts_2ends_2
input_backr   s                           rt   _diff_handlerdiff.<locals>._diff_handler[  s    !8#agg,&D#agg,qww<D!8Dv"'D	"23"2Qq"23!##HJ"v'9%&1
$%\
#[
"MM*;		GGood+G{ ,,y1$7sH(++Gk]F''G ,,6;K sH(++GYF''G6;J ww&++%DMM4F4F)F))*ksKKz;CHH$K	 tVcF3 4684FHJ"v'9%&1
$%\
#[
"EEeL	  !,"YK0!4.	 !  	ood+GtnGsHk]F (GH$GFO CCEJK+,	   tnGsHYF (GH$GFOBB5IJ+
+	   #??F  &!++>"CL !  J mm((11*kJJ_ 4s   :M)r  rq   r  r  r   r   r#   )r  rq   r  r  r   )r/   r   NNNN)r   rj   )
rr   r  rq   r  r  r   r   r  last_outr  s
             rt   r  r    s    r 	1uHL
 	

 DHzx 	
6CtH 	1uq1uA$AD$t$H  !
 Orv   c                   [        5       (       a  [        R                  " U 5      $ [        U S/ SQS5        Sn[	        U40 [        5       D6nSU 0nUR                  [        U R                  5      S9nSU0nUR                  X$US9  U$ )a'  
Element-wise angle of complex numbers. For non-negative real numbers, the angle is 0 while
for negative real numbers, the angle is :math:`\pi`, and NaNs are propagated..

Equation:
    .. math::

        angle(x)=arctan2(x.imag, x.real)

Args:
    x (Tensor): An N-D Tensor, the data type is complex64, complex128, or float32, float64 .
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: An N-D Tensor of real data type with the same precision as that of x's data type.

Examples:
    .. code-block:: pycon

        >>> import paddle

        >>> x = paddle.to_tensor([-2, -1, 0, 1]).unsqueeze(-1).astype('float32')
        >>> y = paddle.to_tensor([-2, -1, 0, 1]).astype('float32')
        >>> z = x + 1j * y
        >>> z
        Tensor(shape=[4, 4], dtype=complex64, place=Place(cpu), stop_gradient=True,
        [[(-2.00000000-2.00000000j), (-2.00000000-1.00000000j),
          (-2.00000000+0.00000000j), (-2.00000000+1.00000000j)],
         [(-1.00000000-2.00000000j), (-1.00000000-1.00000000j),
          (-1.00000000+0.00000000j), (-1.00000000+1.00000000j)],
         [(0.00000000-2.00000000j) , (0.00000000-1.00000000j) ,
           (0.00000000+0.00000000j),  (0.00000000+1.00000000j)],
         [ (1.00000000-2.00000000j),  (1.00000000-1.00000000j),
           (1.00000000+0.00000000j),  (1.00000000+1.00000000j)]])

        >>> theta = paddle.angle(z)
        >>> theta
        Tensor(shape=[4, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[-2.35619450, -2.67794514,  3.14159274,  2.67794514],
         [-2.03444386, -2.35619450,  3.14159274,  2.35619450],
         [-1.57079637, -1.57079637,  0.        ,  1.57079637],
         [-1.10714877, -0.78539819,  0.        ,  0.78539819]])
rr   )r   r   r   r   r   r   angler   r   r   r   )
r-   r   r  r&   r)   r   r   r0   r   r   )rr   r   r   r   r   r   r   s          rt   r  r    s    Z ||A  	
 W11q77(1 8 
 #,ggF
rv   c                    [        5       (       a  [        R                  " X5      $ Sn[        [	        U40 [        5       D65      $ )a  
Computes the Heaviside step function determined by corresponding element in y for each element in x. The equation is

.. math::
    heaviside(x, y)=
        \left\{
            \begin{array}{lcl}
            0,& &\text{if} \ x < 0, \\
            y,& &\text{if} \ x = 0, \\
            1,& &\text{if} \ x > 0.
            \end{array}
        \right.

Note:
    ``paddle.heaviside`` supports broadcasting. If you want know more about broadcasting, please refer to `Introduction to Tensor`_ .

    .. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

Args:
    x (Tensor): The input tensor of Heaviside step function, it's data type should be bfloat16, float16, float32, float64, int32 or int64.
    y (Tensor): The tensor that determines a Heaviside step function, it's data type should be bfloat16, float16, float32, float64, int32 or int64.
    name (str|None, optional): Name for the operation (optional, default is None). Normally there is no need for user to set this property. For more information, please refer to :ref:`api_guide_Name`.

Returns:
    N-D Tensor. A location into which the result is stored. If x and y have different shapes and are broadcastable, the resulting tensor shape is the shape of x and y after broadcasting. If x, y have the same shape, its shape is the same as x and y.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> x = paddle.to_tensor([-0.5, 0, 0.5])
        >>> y = paddle.to_tensor([0.1])
        >>> paddle.heaviside(x, y)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.        , 0.10000000, 1.        ])
        >>> x = paddle.to_tensor([[-0.5, 0, 0.5], [-0.5, 0.5, 0]])
        >>> y = paddle.to_tensor([0.1, 0.2, 0.3])
        >>> paddle.heaviside(x, y)
        Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[0.        , 0.20000000, 1.        ],
         [0.        , 1.        , 0.30000001]])
elementwise_heaviside)r-   r   	heavisider   r)   r   )rr   r   r   r   s       rt   r  r  9  s;    V %%){7?fh?@@rv   c                  U R                   [        R                  [        R                  [        R                  [        R
                  [        R                  [        R                  [        R                  [        R                  [        R                  [        R                  4
;  a  [        SU R                    35      e[        5       (       a+  [        R                   " U 5      n[        R"                  " XUS9$ SU 0n0 n[%        S	0 ['        5       D6n[)        U S/ SQS5        UR+                  U R                   S9nUR-                  SXESU0S9  [/        [%        S
0 ['        5       D65      $ )aM  
This API is used to return the fractional portion of each element in input.

Args:
    x (Tensor): The input tensor, which data type should be int32, int64, float32, float64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
    out (Tensor, optional): The output tensor. Default: None.

Returns:
    Tensor: The output Tensor of frac.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> input = paddle.to_tensor([[12.22000003, -1.02999997],
        ...                           [-0.54999995, 0.66000003]])
        >>> output = paddle.frac(input)
        >>> output
        Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[ 0.22000003, -0.02999997],
         [-0.54999995,  0.66000003]])
cThe data type of input must be one of ['int32', 'int64', 'float32', 'float64', 'float16'], but got r   r   r   )r   r   r   r   r   r   r   r   r   r   )r   rx   r   r   r   r   r   r   INT32INT64r<  r=  FLOAT16rl   r-   r   r   r   r)   r   r&   r   r   r   )rr   r   r   r   r   r   r   s          rt   fracr  k  s(   8 	ww  qrsryryqz{
 	
 LLOq--q11 sG	
 55AGG5Duaj 	 	
 {IIJJrv   c                `   U R                   [        R                  [        R                  [        R                  [        R
                  [        R                  4;  a  [        SU R                    35      e[        5       (       a,  [        R                  " U 5      n[        R                  " X5      $ g)z
Inplace version of ``frac`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_frac`.
r  N)r   rx   r   r   r   r   r   rl   r,   r   r   r   )rr   r   r   s      rt   frac_r    s     	ww  qrsryryqz{
 	
 LLO%% rv   c                   U R                   [        R                  [        R                  [        R                  [        R
                  [        R                  [        R                  [        R                  [        R                  [        R                  [        R                  4
;  a  [        SU R                    35      e[        R                  " U 5      (       a  [        R                  " U 5      n[        R                   " U 5      n[        R"                  " USS9nX#-  n[        R$                  " U5      n[        R&                  " [        R(                  " U5      XT5      n[        R*                  " U5      $ [        R,                  " U 5      $ )a  
For complex tensor, this API returns a new tensor whose elements have the same angles as the corresponding
elements of input and absolute values of one.
For other float dtype tensor,
this API returns sign of every element in `x`: 1 for positive, -1 for negative and 0 for zero, same as paddle.sign.

Args:
    x (Tensor): The input tensor, which data type should be float16, float32, float64, complex64, complex128.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: A sign Tensor for real input, or normalized Tensor for complex input, shape and data type are same as input.

Examples:
    .. code-block:: pycon

        >>> import paddle

        >>> x = paddle.to_tensor([[3 + 4j, 7 - 24j, 0, 1 + 2j], [6 + 8j, 3, 0, -2]])
        >>> paddle.sgn(x)
        Tensor(shape=[2, 4], dtype=complex64, place=Place(cpu), stop_gradient=True,
        [[ (0.60000002+0.80000001j),  (0.28000000-0.95999998j),
           (0.00000000+0.00000000j),  (0.44721359+0.89442718j)],
         [ (0.60000002+0.80000001j),  (1.00000000+0.00000000j),
           (0.00000000+0.00000000j), (-1.00000000+0.00000000j)]])

zlThe data type of input must be one of ['float16', 'float32', 'float64', 'complex64', 'complex128'], but got r   rF  )r   rx   r   r   r   r   r   r   r  r<  r=  	COMPLEX64
COMPLEX128rl   
is_complexas_realr4   rI  rS  rB  r   
as_complexr   )rr   r   expand_xx_absr   r  s         rt   sgnr    s)   8 	ww  z{|  |C  |C  {D  E
 	
 >>!$

1  R0!!!&)fll62EB  (({{1~rv   c                   US;  a  [        SU S35      e[        5       (       a  [        U[        R                  [
        [        R                  R                  45      (       d  [        S[        U5       35      eUR                  [        R                  [        R                  [        R                  [        R                  4;  a  [        SUR                   35      eO[!        USSS/S	5        U R#                  5       nUR#                  5       nUR$                  S
   nUS:X  a  [        R&                  " US:  XV-   U5      nO\US:X  a:  [        R&                  " US:  XV-  U5      n[        R&                  " XV:  XV-  U5      nOUS:X  a  US:  a  [)        USUS-
  5      nUR+                  U5      R-                  UR$                  5      nU$ )a	  
Returns a new tensor with the elements of input tensor x at the given index.
The input tensor is treated as if it were viewed as a 1-D tensor.
The result takes the same shape as the index.

Args:
    x (Tensor): An N-D Tensor, its data type should be int32, int64, float32, float64.
    index (Tensor): An N-D Tensor, its data type should be int32, int64.
    mode (str, optional): Specifies how out-of-bounds index will behave. the candidates are ``'raise'``, ``'wrap'`` and ``'clip'``.

        - ``'raise'``: raise an error (default);
        - ``'wrap'``: wrap around;
        - ``'clip'``: clip to the range. ``'clip'`` mode means that all indices that are too large are replaced by the index that addresses the last element. Note that this disables indexing with negative numbers.

    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, Tensor with the same shape as index, the data type is the same with input.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x_int = paddle.arange(0, 12).reshape([3, 4])
        >>> x_float = x_int.astype(paddle.float64)

        >>> idx_pos = paddle.arange(4, 10).reshape([2, 3])  # positive index
        >>> idx_neg = paddle.arange(-2, 4).reshape([2, 3])  # negative index
        >>> idx_err = paddle.arange(-2, 13).reshape([3, 5])  # index out of range

        >>> paddle.take(x_int, idx_pos)
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[4, 5, 6],
         [7, 8, 9]])

        >>> paddle.take(x_int, idx_neg)
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[10, 11, 0 ],
         [1 , 2 , 3 ]])

        >>> paddle.take(x_float, idx_pos)
        Tensor(shape=[2, 3], dtype=float64, place=Place(cpu), stop_gradient=True,
        [[4., 5., 6.],
         [7., 8., 9.]])

        >>> x_int.take(idx_pos)
        Tensor(shape=[2, 3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[4, 5, 6],
         [7, 8, 9]])

        >>> paddle.take(x_int, idx_err, mode='wrap')
        Tensor(shape=[3, 5], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[10, 11, 0 , 1 , 2 ],
         [3 , 4 , 5 , 6 , 7 ],
         [8 , 9 , 10, 11, 0 ]])

        >>> paddle.take(x_int, idx_err, mode='clip')
        Tensor(shape=[3, 5], dtype=int64, place=Place(cpu), stop_gradient=True,
        [[0 , 0 , 0 , 1 , 2 ],
         [3 , 4 , 5 , 6 , 7 ],
         [8 , 9 , 10, 11, 11]])

)raisewrapr  zA'mode' in 'take' should be 'raise', 'wrap', 'clip', but received r   z,The type of 'index' must be Tensor, but got zDThe data type of 'index' must be one of ['int32', 'int64'], but got r   r   r   taker   r  r   r  r  r/   )r   r-   rg   rx   rc   r(   ry   r   rl   rm   r   r   r   r   r  r  r&   r  ro   rB  r  index_selectr  )rr   r   moder   input_1dindex_1d	max_indexr   s           rt   r  r    s   L ,,OPTvUVW
 	
 %&--6::;K;K!LMM>tE{mL  ;;LLLLNNNN	
 
 VW\WbWbVcd 
 	!'71CVLyy{H}}Hr"Iw<<1h.BHM	<<1h.BHM<<!8#7
 
q=HaQ7H



)
1
1%++
>CJrv   c           
     X   U R                   [        R                  [        R                  [        R
                  [        R                  4;  a  [        SU R                    35      e[        R                  " U 5      n[        R                  " [        R                  " U5      5      n[        R                  " [        R                  " U5      [        R                  " US5      U5      n[        R                  " USU-  5      n[        R                  " US:  [        R                  " U[        R                   " U5      5      U5      n[        R                  " US:  [        R                  " US[        R                   " U5      -  5      U5      n[        R                  " U S:  US-  U5      nXC4$ )aL  
The function used to decompose a floating point number into mantissa and exponent.

Args:
    x (Tensor): The input tensor, it's data type should be float32, float64.
    name (str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:

    - mantissa (Tensor), A mantissa Tensor. The shape and data type of mantissa tensor and exponential tensor are
        the same as those of input.

    - exponent (Tensor), A exponent Tensor. The shape and data type of mantissa tensor and exponential tensor are
        the same as those of input.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([[1, 2, 3, 4]], dtype="float32")
        >>> mantissa, exponent = paddle.tensor.math.frexp(x)
        >>> mantissa
        Tensor(shape=[1, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[0.50000000, 0.50000000, 0.75000000, 0.50000000]])
        >>> exponent
        Tensor(shape=[1, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[1., 2., 2., 3.]])
zFThe data type of input must be one of ['float32', 'float64'], but got r   r#   r/   r   )r   rx   r   r   r   r<  r=  rl   r4   rN   r   rB  r   r:  r   r   	ones_like)rr   r   input_xr   mantissas        rt   frexpr  j  sK   < 	ww	  TUVU\U\T]^
 	
 jjmG||FKK01H||X 0 01 =xH
 }}Wak2H||	Q

8V--h78H
 ||	QhV%5%5h%? ?@H ||QUX]H=Hrv   c                v   US:X  a  [         R                  nOUS:X  a  [         R                  nUb  Ub  [        S5      eU R                  [         R
                  [         R                  [         R                  [         R                  R                  R                  R                  [         R                  R                  R                  R                  [         R                  R                  R                  R                  4;  a  [        SU R                   35      eU R                  nXc   nUS:  a  X0R!                  5       -  nUc?  Uc  Sn[         R"                  " U5      nUR!                  5       S:  a  [        SU 35      eGOQUR                  [         R
                  [         R                  [         R                  [         R                  R                  R                  R                  [         R                  R                  R                  R                  [         R                  R                  R                  R                  4;  a  [        SUR                   35      eUR!                  5       S:X  aM  [         R$                  " U5      nS/U R!                  5       -  nUR                  S   X'   UR'                  U5      nO[         R$                  " XS	9nS
W" [         R(                  " U [         R*                  " SU5      US	9[         R(                  " U [         R*                  " SUS-
  5      US	9-   U-  US	9-  $ )a  
Integrate along the given axis using the composite trapezoidal rule.

Args:
    y (Tensor): Input tensor to integrate. It's data type should be float16, float32, float64.
    x (Tensor|None, optional): The sample points corresponding to the :attr:`y` values, the same type as :attr:`y`.
        It is known that the size of :attr:`y` is `[d_1, d_2, ... , d_n]` and :math:`axis=k`, then the size of :attr:`x` can only be `[d_k]` or `[d_1, d_2, ... , d_n ]`.
        If :attr:`x` is None, the sample points are assumed to be evenly spaced :attr:`dx` apart. The default is None.
    dx (float|None, optional): The spacing between sample points when :attr:`x` is None. If neither :attr:`x` nor :attr:`dx` is provided then the default is :math:`dx = 1`.
    axis (int, optional): The axis along which to integrate. The default is -1.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
    sum_mode (str): use a different summation. The default is `sum`.

Returns:
    Tensor, Definite integral of :attr:`y` is N-D tensor as approximated along a single axis by the trapezoidal rule.
r   r  z2Not permitted to specify both x and dx input args.zThe data type of input must be Tensor, and dtype should be one of ['paddle.float16', 'paddle.float32', 'paddle.float64', 'paddle.base.core.DataType.FLOAT16', 'paddle.base.core.DataType.FLOAT32', 'paddle.base.core.DataType.FLOAT64'], but got r   r9  r/   z#Expected dx to be a scalar, got dx=rF  rB  )rx   r   r  r   r   r   r   r   r;  r+   r   r  r<  r=  rl   ro   r  r  r  r  gatherrH  )	r   rr   dxrq   r  sum_moder  lengthro   s	            rt   
_trapezoidr    s   . u}::		==IMNNww!!))!!))!!))   @  AB  AH  AH  @I  J
 	
 ggG]Faxy:Bb!668a<B2$GHH  77NNNNNNKK%%--KK%%--KK%%--
 
  D  EF  EL  EL  DM  N  557a<QBC!%%'ME((1+EKE"BQ*BMM!V]]1f5DAmmAv}}Q
;$GH 		
   rv   c                    [        XX#SS9$ )a	  
Integrate along the given axis using the composite trapezoidal rule. Use the sum method.

Args:
    y (Tensor): Input tensor to integrate. It's data type should be float16, float32, float64.
    x (Tensor|None, optional): The sample points corresponding to the :attr:`y` values, the same type as :attr:`y`.
        It is known that the size of :attr:`y` is `[d_1, d_2, ... , d_n]` and :math:`axis=k`, then the size of :attr:`x` can only be `[d_k]` or `[d_1, d_2, ... , d_n ]`.
        If :attr:`x` is None, the sample points are assumed to be evenly spaced :attr:`dx` apart. The default is None.
    dx (float|None, optional): The spacing between sample points when :attr:`x` is None. If neither :attr:`x` nor :attr:`dx` is provided then the default is :math:`dx = 1`.
    axis (int, optional): The axis along which to integrate. The default is -1.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, Definite integral of :attr:`y` is N-D tensor as approximated along a single axis by the trapezoidal rule.
    If :attr:`y` is a 1D tensor, then the result is a float. If N is greater than 1, then the result is an (N-1)-D tensor.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> y = paddle.to_tensor([4, 5, 6], dtype='float32')

        >>> paddle.trapezoid(y)
        Tensor(shape=[], dtype=float32, place=Place(cpu), stop_gradient=True,
        10.)

        >>> paddle.trapezoid(y, dx=2.)
        Tensor(shape=[], dtype=float32, place=Place(cpu), stop_gradient=True,
        20.)

        >>> y = paddle.to_tensor([4, 5, 6], dtype='float32')
        >>> x = paddle.to_tensor([1, 2, 3], dtype='float32')

        >>> paddle.trapezoid(y, x)
        Tensor(shape=[], dtype=float32, place=Place(cpu), stop_gradient=True,
        10.)

        >>> y = paddle.to_tensor([1, 2, 3], dtype='float64')
        >>> x = paddle.to_tensor([8, 6, 4], dtype='float64')

        >>> paddle.trapezoid(y, x)
        Tensor(shape=[], dtype=float64, place=Place(cpu), stop_gradient=True,
        -8.)
        >>> y = paddle.arange(6).reshape((2, 3)).astype('float32')

        >>> paddle.trapezoid(y, axis=0)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [1.50000000, 2.50000000, 3.50000000])
        >>> paddle.trapezoid(y, axis=1)
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [2., 8.])
r   r  r  r   rr   r  rq   r   s        rt   	trapezoidr    s    x aB511rv   c                    [        XX#SS9$ )a8
  
Integrate along the given axis using the composite trapezoidal rule. Use the cumsum method

Args:
    y (Tensor): Input tensor to integrate. It's data type should be float16, float32, float64.
    x (Tensor|None, optional): The sample points corresponding to the :attr:`y` values, the same type as :attr:`y`.
        It is known that the size of :attr:`y` is `[d_1, d_2, ... , d_n]` and :math:`axis=k`, then the size of :attr:`x` can only be `[d_k]` or `[d_1, d_2, ... , d_n ]`.
        If :attr:`x` is None, the sample points are assumed to be evenly spaced :attr:`dx` apart. The default is None.
    dx (float|None, optional): The spacing between sample points when :attr:`x` is None. If neither :attr:`x` nor :attr:`dx` is provided then the default is :math:`dx = 1`.
    axis (int, optional): The axis along which to integrate. The default is -1.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor, Definite integral of :attr:`y` is N-D tensor as approximated along a single axis by the trapezoidal rule.
    The result is an N-D tensor.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> y = paddle.to_tensor([4, 5, 6], dtype='float32')

        >>> paddle.cumulative_trapezoid(y)
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [4.50000000, 10.       ])

        >>> paddle.cumulative_trapezoid(y, dx=2.)
        >>> # Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        >>> #        [9. , 20.])

        >>> y = paddle.to_tensor([4, 5, 6], dtype='float32')
        >>> x = paddle.to_tensor([1, 2, 3], dtype='float32')

        >>> paddle.cumulative_trapezoid(y, x)
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [4.50000000, 10.       ])

        >>> y = paddle.to_tensor([1, 2, 3], dtype='float64')
        >>> x = paddle.to_tensor([8, 6, 4], dtype='float64')

        >>> paddle.cumulative_trapezoid(y, x)
        Tensor(shape=[2], dtype=float64, place=Place(cpu), stop_gradient=True,
        [-3., -8.])

        >>> y = paddle.arange(6).reshape((2, 3)).astype('float32')

        >>> paddle.cumulative_trapezoid(y, axis=0)
        Tensor(shape=[1, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[1.50000000, 2.50000000, 3.50000000]])
        >>> paddle.cumulative_trapezoid(y, axis=1)
        Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[0.50000000, 2.        ],
         [3.50000000, 8.        ]])
r  r  r  r  s        rt   cumulative_trapezoidr  :  s    | aB844rv   c           
     0   [        U S/ SQS5        U R                  5       S:w  a  [        SU R                  5        S35      eUc  U R                  S   nUS:  a  [        S	5      e[        R
                  " U R                  S   U/U R                  S
9n[        R                  " 5       (       am  US:  a'  [        R                  " S/U R                  S
9USS2S4'   US:  a9  U SS2S4   USS2SS24'   [        R                  " USS2SS24   SS9USS2SS24'   OUS:  aJ  [        R                  R                  U[        S5      S4[        R                  " S/U R                  S
95      nUS:  a  [        R                  R                  U[        S5      [        SS5      4U SS2S4   5      n[        R                  R                  U[        S5      [        SS5      4[        R                  " USS2SS24   SS95      nU(       d  USS2SSS24   nU$ UnU$ )a#	  
Generate a Vandermonde matrix.

The columns of the output matrix are powers of the input vector. Order of the powers is
determined by the increasing Boolean parameter. Specifically, when the increment is
"false", the ith output column is a step-up in the order of the elements of the input
vector to the N - i - 1 power. Such a matrix with a geometric progression in each row
is named after Alexandre-Theophile Vandermonde.

Args:
    x (Tensor): The input tensor, it must be 1-D Tensor, and it's data type should be ['complex64', 'complex128', 'float32', 'float64', 'int32', 'int64'].
    n (int|None): Number of columns in the output. If n is not specified, a square array is returned (n = len(x)).
    increasing(bool): Order of the powers of the columns. If True, the powers increase from left to right, if False (the default) they are reversed.
    name (str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
Returns:
    Tensor, A vandermonde matrix with shape (len(x), N). If increasing is False, the first column is :math:`x^{(N-1)}`, the second :math:`x^{(N-2)}` and so forth.
    If increasing is True, the columns are :math:`x^0`, :math:`x^1`, ..., :math:`x^{(N-1)}`.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> x = paddle.to_tensor([1., 2., 3.], dtype="float32")
        >>> out = paddle.vander(x)
        >>> out
        Tensor(shape=[3, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[1., 1., 1.],
         [4., 2., 1.],
         [9., 3., 1.]])
        >>> out1 = paddle.vander(x,2)
        >>> out1
        Tensor(shape=[3, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[1., 1.],
         [2., 1.],
         [3., 1.]])
        >>> out2 = paddle.vander(x, increasing = True)
        >>> out2
        Tensor(shape=[3, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[1., 1., 1.],
         [1., 2., 4.],
         [1., 3., 9.]])
        >>> real = paddle.to_tensor([2., 4.])
        >>> imag = paddle.to_tensor([1., 3.])
        >>> complex = paddle.complex(real, imag)
        >>> out3 = paddle.vander(complex)
        >>> out3
        Tensor(shape=[2, 2], dtype=complex64, place=Place(cpu), stop_gradient=True,
        [[(2+1j), (1+0j)],
         [(4+3j), (1+0j)]])
rr   )r   r   r   r   r   r   vanderr/   zNThe input of x is expected to be a 1-D Tensor.But now the dims of Input(X) is r   Nr   zN must be non-negative.r   r   )r  )r&   r  r   ro   rx   emptyr   r,   r  r  r  setitemr  )rr   r  
increasingr   r  s        rt   r  r  {  s   p 	K	 	uuw!|//0uuwiq:
 	

 	yGGAJ1u233
,,
Aagg
6Cq5((!AGG<C1Iq51d7C12JAqrE
;C12Jq5--''eDk1%v'7'7177'KC q5--''eDk5D>2AagJC --''teAtn-s1ab5zr2C
 )#a2g,CJ /2CJrv   c                &   [        5       (       a  [        R                  " X5      $ [        U SSS/S5        [        USSS/S5        Sn[	        U40 [        5       D6nXS.nUR                  [        R                  S9nSU0nUR                  X5US	9  U$ )
a  
Return the next floating-point value after input towards other, elementwise.
The shapes of input and other must be broadcastable.

Args:
    x (Tensor): An N-D Tensor, the data type is float32, float64.
    y (Tensor): An N-D Tensor, the data type is float32, float64.
    name(str, optional):Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): An N-D Tensor, the shape and data type is the same with input.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> out = paddle.nextafter(paddle.to_tensor([1.0,2.0]),paddle.to_tensor([2.0,1.0]))
        >>> out
        Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
        [1.00000012, 1.99999988])
rr   r   r   	nextafterr   r   r   r   r   )
r-   r   r  r&   r)   r   r   rx   r   r   )rr   r   r   r   r   r   r   r   s           rt   r  r    s    , %% C)Y)?M C)Y)?MW11!77fnn7M#,ggFJrv   c                    [        5       (       a  [        R                  " U 5      $ [        U S/ SQS5        [	        S0 [        5       D6nUR                  U R                  S9nUR                  SSU 0SU0S9  U$ )ao  
The function used to calculate modified bessel function of order 0.

Equation:
    ..  math::

        I_0(x) = \sum^{\infty}_{k=0}\frac{(x^2/4)^k}{(k!)^2}

Args:
    x (Tensor): The input tensor, it's data type should be float32, float64,
        uint8, int8, int16, int32, int64.
    name (str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
    - out (Tensor), A Tensor. the value of the modified bessel function of order 0 at x
        (integer types are autocasted into float32).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([0, 1, 2, 3, 4], dtype="float32")
        >>> paddle.i0(x)
        Tensor(shape=[5], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.99999994 , 1.26606596 , 2.27958512 , 4.88079262 , 11.30192089])
rr   r   r   r   r   r   r   r   i0r   r   r   )r  )	r-   r   r  r&   r)   r   r   r   r   r&  s       rt   r  r    sy    8 yy| N		
 .VX.77agg7FdC8eS\JJrv   c                N    [        5       (       a  [        R                  " U 5      $ g)z{
Inplace version of ``i0`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_i0`.
N)r,   r   i0_r   s     rt   r  r  /  s      zz!} rv   c                    [        5       (       a  [        R                  " U 5      $ [        U S/ SQS5        [	        S0 [        5       D6nUR                  U R                  S9nUR                  SSU 0SU0S9  U$ )a  
The function used to calculate exponentially scaled modified Bessel function of order 0.

Equation:
    ..  math::

        I_0(x) = \sum^{\infty}_{k=0}\frac{(x^2/4)^k}{(k!)^2} \\
        I_{0e}(x) = e^{-|x|}I_0(x)

Args:
    x (Tensor): The input tensor, it's data type should be float32, float64,
        uint8, int8, int16, int32, int64.
    name (str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
    - out (Tensor), A Tensor. the value of the exponentially scaled modified Bessel function of order 0 at x
        (integer types are autocasted into float32).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([0, 1, 2, 3, 4], dtype="float32")
        >>> print(paddle.i0e(x))
        Tensor(shape=[5], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.99999994, 0.46575963, 0.30850831, 0.24300036, 0.20700191])
rr   r  i0er   r   r   )r  )	r-   r   r  r&   r)   r   r   r   r   r&  s       rt   r  r  :  sy    : zz!} N		
 /fh/77agg7FeS!HuclKJrv   c                    [        5       (       a  [        R                  " U 5      $ [        U S/ SQS5        [	        S0 [        5       D6nUR                  U R                  S9nUR                  SSU 0SU00 S9  U$ )a  
The function is used to calculate modified bessel function of order 1.

Args:
    x (Tensor): The input tensor, it's data type should be float32, float64,
        uint8, int8, int16, int32, int64.
    name (str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
    - out (Tensor), A Tensor. the value of the modified bessel function of order 1 at x
        (integer types are autocasted into float32).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([0, 1, 2, 3, 4], dtype="float32")
        >>> print(paddle.i1(x))
        Tensor(shape=[5], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.        , 0.56515908, 1.59063685, 3.95337057, 9.75946712])
rr   r  i1r   r   r   )r   )	r-   r   r   r&   r)   r   r   r   r   r&  s       rt   r   r   g  s    . yy| N		
 .VX.77agg7FsAhB 	 	
 Jrv   c                    [        5       (       a  [        R                  " U 5      $ [        U S/ SQS5        [	        S0 [        5       D6nUR                  U R                  S9nUR                  SSU 0SU00 S9  U$ )aH  
The function is used to calculate exponentially scaled modified Bessel function of order 1.

Args:

    x (Tensor): The input tensor, it's data type should be float32, float64,
        uint8, int8, int16, int32, int64.
    name (str|None, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.

Returns:
    - out (Tensor), A Tensor. the value of the exponentially scaled modified Bessel function of order 1 at x
        (integer types are autocasted into float32).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([0, 1, 2, 3, 4], dtype="float32")
        >>> print(paddle.i1e(x))
        Tensor(shape=[5], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.        , 0.20791042, 0.21526928, 0.19682673, 0.17875087])
rr   r  i1er   r   r   )r  )	r-   r   r  r&   r)   r   r   r   r   r&  s       rt   r  r    s    0 zz!} N		
 /fh/77agg7FQx%R 	 	
 Jrv   c                   [        U[        5      (       d  [        S[        U5       S35      eUS:  a  [	        SU 35      eUS:X  a  [        U 5      $ [        5       (       a  [        R                  " X5      $ [        U S/ SQS5        [        S0 [        5       D6nUR                  U R                  S9nUR                  SSU 0S	U0S
U0S9  U$ )a  
Calculates the polygamma of the given input tensor, element-wise.

The equation is:

.. math::
    \Phi^n(x) = \frac{d^n}{dx^n} [\ln(\Gamma(x))]

Args:
    x (Tensor): Input Tensor. Must be one of the following types: float32, float64,
        uint8, int8, int16, int32, int64.
    n (int): Order of the derivative. Must be integral.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    - out (Tensor), A Tensor. the polygamma of the input Tensor, the shape and data type is the same with input
        (integer types are autocasted into float32).

Examples:
    .. code-block:: python

        >>> import paddle

        >>> data = paddle.to_tensor([2, 3, 25.5], dtype='float32')
        >>> res = paddle.polygamma(data, 1)
        >>> print(res)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [0.64493412,  0.39493406,  0.03999467])
/The input of n must be int type, but received: r   r   DThe input of n must be greater than or equal to 0. But received n = rr   r  	polygammar   r   r  r   )r  )rg   rk   rl   rm   r   r-  r-   r   r  r&   r)   r   r   r   r   )rr   r  r   r   r   s        rt   r  r    s    < a=d1gYaH
 	
 	1uRSTRUV
 	
 	Avqz!####A))$  !99F;;!'';JC QxAh	   
rv   c                    [        U[        5      (       d  [        S[        U5       S35      eUS:  a  [	        SU 35      eUS:X  a  [        U 5      $ [        5       (       a  [        R                  " X5      $ g)
Inplace version of ``polygamma`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_polygamma`.
r  r   r   r  N)	rg   rk   rl   rm   r   r/  r,   r   
polygamma_)rr   r  r   s      rt   r	  r	     s     a=d1gYaH
 	
 	1uRSTRUV
 	
 	Av{$$Q** rv   c                p   [        U [        R                  [        [        R                  R
                  45      (       d  [        S[        U 5       35      e[        U[        R                  [        [        R                  R
                  45      (       d  [        S[        U5       35      eU R                  [        R                  :X  d  UR                  [        R                  :X  a  [        R                  nObU R                  [        R                  :X  d  UR                  [        R                  :X  a  [        R                  nO[        R                  " 5       nU R                  US9n UR                  US9n[        R                  " SUS9n[        R                  " U [        R                   " XA5      5      $ )aJ  
Compute the result of multiplying x by 2 to the power of y. The equation is:

.. math::
    out = x * 2^{y}

Args:
    x (Tensor): The input Tensor, the data type is float32, float64, int32 or int64.
    y (Tensor):  A Tensor of exponents, typically integers.
    name (str|None, optional): Name for the operation (optional, default is None).For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): An N-D Tensor. If x, y have different shapes and are "broadcastable", the resulting tensor shape is the shape of x and y after broadcasting. If x, y have the same shape, its shape is the same as x and y. And the data type is float32 or float64.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> # example1
        >>> x = paddle.to_tensor([1, 2, 3], dtype='float32')
        >>> y = paddle.to_tensor([2, 3, 4], dtype='int32')
        >>> res = paddle.ldexp(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [4. , 16., 48.])

        >>> # example2
        >>> x = paddle.to_tensor([1, 2, 3], dtype='float32')
        >>> y = paddle.to_tensor([2], dtype='int32')
        >>> res = paddle.ldexp(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [4. , 8. , 12.])

x must be tensor type, but got y must be tensor type, but got r   r#   )rg   rx   rc   r(   ry   r   rl   rm   r   r   r   r=  get_default_dtyper   r  r   r   rr   r   r   rx  twos        rt   ldexpr    s'   L a&--6::3C3CDEE9$q'CDDa&--6::3C3CDEE9$q'CDDww&.. AGGv~~$=NN		
H$$	$83C3C(C$$	,,.		y!A	y!A


1I
.C??1fjj011rv   c                j   [        U [        R                  [        45      (       d  [	        S[        U 5       35      e[        U[        R                  [        45      (       d  [	        S[        U5       35      eU R                  [        R                  :X  d  UR                  [        R                  :X  a  SnO[        R                  " 5       n[        R                  " XS9n [        R                  " XS9n[        R                  " SUS9n[        R                  " U [        R                  " XA5      5      $ )r  r  r  r   r   r#   )rg   rx   rc   r(   rl   rm   r   r   r  r3   r2   r  r  r   r  s        rt   ldexp_r  K  s    
 a&--2339$q'CDDa&--2339$q'CDDww&.. AGGv~~$=	,,.	Q(AA'A


1I
.CAvzz#122rv   c                   [        US/ SQU 5        Ub  [        US/ SQU 5        [        U 40 [        5       D6nUR                  UR                  :X  d   eUR	                  UR                  S9nUR                  U XS.SU0SU0S9  U$ )	Nrr   )r   r   r   r   r   r   r   r   r   is_arithmeticr   )r&   r)   r   r   r   r   )op_namerr   r   r  r   r   r   s          rt   _bitwise_opr  ^  s    	4	 	} 8		
 -FH-F77agg

3
3!''
3
BC
.	   Jrv   c           	     p    [        5       (       a  Uc  [        R                  " XU5      $ [        SU UUUUS9$ )a
  
Apply ``bitwise_left_shift`` on Tensor ``X`` and ``Y`` .

.. math::

    Out = X \ll Y

.. note::

    ``paddle.bitwise_left_shift`` supports broadcasting. If you want know more about broadcasting, please refer to please refer to `Introduction to Tensor`_ .

.. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

Args:
    x (Tensor): Input Tensor of ``bitwise_left_shift`` . It is a N-D Tensor of uint8, int8, int16, int32, int64.
    y (Tensor): Input Tensor of ``bitwise_left_shift`` . It is a N-D Tensor of uint8, int8, int16, int32, int64.
    is_arithmetic (bool, optional): A boolean indicating whether to choose arithmetic shift, if False, means logic shift. Default True.
    out (Tensor|None, optional): Result of ``bitwise_left_shift`` . It is a N-D Tensor with the same data type of input Tensor. Default: None.
    name (str|None, optional): The default value is None.  Normally there is no need for
        user to set this property.  For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: Result of ``bitwise_left_shift`` . It is a N-D Tensor with the same data type of input Tensor.

Examples:
    .. code-block:: python
        :name: bitwise_left_shift_example1

        >>> import paddle
        >>> x = paddle.to_tensor([[1,2,4,8],[16,17,32,65]])
        >>> y = paddle.to_tensor([[1,2,3,4,], [2,3,2,1]])
        >>> paddle.bitwise_left_shift(x, y, is_arithmetic=True)
        Tensor(shape=[2, 4], dtype=int64, place=Place(gpu:0), stop_gradient=True,
               [[2  , 8  , 32 , 128],
                [64 , 136, 128, 130]])

    .. code-block:: python
        :name: bitwise_left_shift_example2

        >>> import paddle
        >>> x = paddle.to_tensor([[1,2,4,8],[16,17,32,65]])
        >>> y = paddle.to_tensor([[1,2,3,4,], [2,3,2,1]])
        >>> paddle.bitwise_left_shift(x, y, is_arithmetic=False)
        Tensor(shape=[2, 4], dtype=int64, place=Place(gpu:0), stop_gradient=True,
            [[2  , 8  , 32 , 128],
                [64 , 136, 128, 130]])
bitwise_left_shiftr  rr   r   r  r   r   )r-   r   r  r  rr   r   r  r   r   s        rt   r  r  |  sD    l CK((}==$

# rv   c                    [        U R                  UR                  5      nXPR                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " XU5      $ g)z
Inplace version of ``bitwise_left_shift`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_bitwise_left_shift`.
r   r   r   N)r   ro   r   r-   r   bitwise_left_shift_rr   r   r  r   r   r   s         rt   r  r    su      1IGG,YK7abcbibiaj  kE  F
 	
 ))!>>  rv   c           	     p    [        5       (       a  Uc  [        R                  " XU5      $ [        SU UUUUS9$ )aP  
Apply ``bitwise_right_shift`` on Tensor ``X`` and ``Y`` .

.. math::

    Out = X \gg Y

.. note::

    ``paddle.bitwise_right_shift`` supports broadcasting. If you want know more about broadcasting, please refer to please refer to `Introduction to Tensor`_ .

.. _Introduction to Tensor: ../../guides/beginner/tensor_en.html#chapter5-broadcasting-of-tensor

Args:
    x (Tensor): Input Tensor of ``bitwise_right_shift`` . It is a N-D Tensor of uint8, int8, int16, int32, int64.
    y (Tensor): Input Tensor of ``bitwise_right_shift`` . It is a N-D Tensor of uint8, int8, int16, int32, int64.
    is_arithmetic (bool, optional): A boolean indicating whether to choose arithmetic shift, if False, means logic shift. Default True.
    out (Tensor|None, optional): Result of ``bitwise_right_shift`` . It is a N-D Tensor with the same data type of input Tensor. Default: None.
    name (str|None, optional): The default value is None.  Normally there is no need for
        user to set this property.  For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor: Result of ``bitwise_right_shift`` . It is a N-D Tensor with the same data type of input Tensor.

Examples:
    .. code-block:: python
        :name: bitwise_right_shift_example1

        >>> import paddle
        >>> x = paddle.to_tensor([[10,20,40,80],[16,17,32,65]])
        >>> y = paddle.to_tensor([[1,2,3,4,], [2,3,2,1]])
        >>> paddle.bitwise_right_shift(x, y, is_arithmetic=True)
        Tensor(shape=[2, 4], dtype=int64, place=Place(gpu:0), stop_gradient=True,
               [[5 , 5 , 5 , 5 ],
                [4 , 2 , 8 , 32]])

    .. code-block:: python
        :name: bitwise_right_shift_example2

        >>> import paddle
        >>> x = paddle.to_tensor([[-10,-20,-40,-80],[-16,-17,-32,-65]], dtype=paddle.int8)
        >>> y = paddle.to_tensor([[1,2,3,4,], [2,3,2,1]], dtype=paddle.int8)
        >>> paddle.bitwise_right_shift(x, y, is_arithmetic=False)  # logic shift
        Tensor(shape=[2, 4], dtype=int8, place=Place(gpu:0), stop_gradient=True,
            [[123, 59 , 27 , 11 ],
                [60 , 29 , 56 , 95 ]])
bitwise_right_shiftr  )r-   r   r  r  r  s        rt   r  r    sD    l CK))!>>%

# rv   c                    [        U R                  UR                  5      nXPR                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " XU5      $ g)z
Inplace version of ``bitwise_right_shift`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_bitwise_left_shift`.
r   r   r   N)r   ro   r   r-   r   bitwise_right_shift_r  s         rt   r!  r!    su      1IGG,YK7abcbibiaj  kE  F
 	
 **1??  rv   c                    [        U[        5      (       a  [        R                  " XR                  S9nO [        U[
        5      (       a  [        S5      e[        XUS S 5      $ Nr   z8unsupported operand type(s) for <<: 'Tensor' and 'float'rg   rk   rx   r  r   r   rl   r  rr   r   r  s      rt   
__lshift__r&  ,  U    
 !SQgg.	Au		F
 	
 aM4>>rv   c                    [        U[        5      (       a  [        R                  " XR                  S9nO [        U[
        5      (       a  [        S5      e[        XUS S 5      $ r#  rg   rk   rx   r  r   r   rl   r  r%  s      rt   
__rshift__r*  :  U    
 !SQgg.	Au		F
 	
 q]D$??rv   c                    [        U[        5      (       a  [        R                  " XR                  S9nO [        U[
        5      (       a  [        S5      e[        XUS S 5      $ Nr   z8unsupported operand type(s) for <<: 'float' and 'Tensor'r$  r%  s      rt   __rlshift__r.  H  r'  rv   c                    [        U[        5      (       a  [        R                  " XR                  S9nO [        U[
        5      (       a  [        S5      e[        XUS S 5      $ r-  r)  r%  s      rt   __rrshift__r0  V  r+  rv   c                   [        U[        [        45      (       a  [        R                  " XR
                  S9n[        U R                  UR                  5      nU[        U R                  5      :w  a'  [        R                  " SU SU R                   S35        [        5       (       a  [        R                  " X5      $ [        S	0 [        5       D6nUR!                  U R
                  S9nUR#                  SXS.SU0S9  U$ )
a  
Create a new floating-point tensor with the magnitude of input ``x`` and the sign of ``y``, elementwise.

Equation:
    .. math::

        copysign(x_{i},y_{i})=\left\{\begin{matrix}
        & -|x_{i}| & if \space y_{i} <= -0.0\\
        & |x_{i}| & if \space y_{i} >= 0.0
        \end{matrix}\right.

Args:
    x (Tensor): The input Tensor, magnitudes, the data type is bool, uint8, int8, int16, int32, int64, bfloat16, float16, float32, float64.
    y (Tensor|float): contains value(s) whose signbit(s) are applied to the magnitudes in input.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor), the output tensor. The data type is the same as the input tensor.

Examples:
    .. code-block:: python
        :name: example1

        >>> import paddle
        >>> x = paddle.to_tensor([1, 2, 3], dtype='float64')
        >>> y = paddle.to_tensor([-1, 1, -1], dtype='float64')
        >>> out = paddle.copysign(x, y)
        >>> print(out)
        Tensor(shape=[3], dtype=float64, place=Place(gpu:0), stop_gradient=True,
               [-1.,  2., -3.])

    .. code-block:: python
        :name: example2

        >>> import paddle
        >>> x = paddle.to_tensor([1, 2, 3], dtype='float64')
        >>> y = paddle.to_tensor([-2], dtype='float64')
        >>> res = paddle.copysign(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=float64, place=Place(gpu:0), stop_gradient=True,
               [-1.,  -2.,  -3.])

    .. code-block:: python
        :name: example_zero1

        >>> import paddle
        >>> x = paddle.to_tensor([1, 2, 3], dtype='float64')
        >>> y = paddle.to_tensor([0.0], dtype='float64')
        >>> out = paddle.copysign(x, y)
        >>> print(out)
        Tensor(shape=[3], dtype=float64, place=Place(gpu:0), stop_gradient=True,
            [1., 2., 3.])

    .. code-block:: python
        :name: example_zero2

        >>> import paddle
        >>> x = paddle.to_tensor([1, 2, 3], dtype='float64')
        >>> y = paddle.to_tensor([-0.0], dtype='float64')
        >>> out = paddle.copysign(x, y)
        >>> print(out)
        Tensor(shape=[3], dtype=float64, place=Place(gpu:0), stop_gradient=True,
            [-1., -2., -3.])
r   r   z2 is different from the input tensor x with shape: z8, please make sure you are using copysign api correctly.copysignr   r   r   )r2  )rg   r   rk   rx   r  r   r   ro   rh   warningswarnr-   r   r2  r)   r   r   r   )rr   r   r   r   r   r   s         rt   r2  r2  d  s    B !eS\""Qgg.1IDM!,YK7ijkjqjqir  sk  l	
 q$$468477agg7F!$4ucl 	 	
 
rv   c                6   [        U[        [        45      (       a  [        R                  " XR
                  S9n[        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        R                  " X5      $ )z
Inplace version of ``copysign`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_copysign`.
r   r   r   r   )rg   r   rk   rx   r  r   r   ro   r   r   	copysign_r  s       rt   r6  r6    s     !eS\""Qgg.1IGG,YK7abcbibiaj  kE  F
 	
 A!!rv   c                   [        U [        R                  [        [        R                  R
                  45      (       d  [        S[        U 5       35      e[        U[        R                  [        [        R                  R
                  45      (       d  [        S[        U5       35      e[        R                  " U S5      [        R                  " US5      -   R                  5       nU$ )a  
Calculate the length of the hypotenuse of a right-angle triangle. The equation is:

.. math::
    out = {\sqrt{x^2 + y^2}}

Args:
    x (Tensor): The input Tensor, the data type is float32, float64, int32 or int64.
    y (Tensor): The input Tensor, the data type is float32, float64, int32 or int64.
    name (str|None, optional): Name for the operation (optional, default is None).For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): An N-D Tensor. If x, y have different shapes and are "broadcastable", the resulting tensor shape is the shape of x and y after broadcasting. If x, y have the same shape, its shape is the same as x and y. And the data type is float32 or float64.

Examples:

    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([3], dtype='float32')
        >>> y = paddle.to_tensor([4], dtype='float32')
        >>> res = paddle.hypot(x, y)
        >>> print(res)
        Tensor(shape=[1], dtype=float32, place=Place(cpu), stop_gradient=True,
        [5.])

r  r  r#   )
rg   rx   rc   r(   ry   r   rl   rm   r   r[   r  s       rt   hypotr8    s    : a&--6::3C3CDEE9$q'CDDa&--6::3C3CDEE9$q'CDD::afjjA..
4
4
6CJrv   c                p   [        U [        R                  [        45      (       d  [	        S[        U 5       35      e[        U[        R                  [        45      (       d  [	        S[        U5       35      eU R                  S5      R                  UR                  S5      5      R                  5       nU$ )z
Inplace version of ``hypot`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_hypot`.
r  r  r#   )
rg   rx   rc   r(   rl   rm   r   r   r   r\   r  s       rt   hypot_r:    s     a&--2339$q'CDDa&--2339$q'CDD
&&)..q
"
(
(
*CJrv   c                   [        U R                  5      S:w  a  [        SU R                   35      e[        U[        5      (       a  US:  a  [        SU 35      eUS:X  a   [        R                  " S/U R                  S9$ US:  a1  [        U5       Vs/ s H  o@PM     nn[        R                  " U5      nOU /nU R                  5       n[        R                  " USS9nUS:  a1  [        U5       Vs/ s H  oHPM     nn[        R                  " U5      n	OU/n	[        R                  " U R                  U-  SS	S9n
U(       a%  [        US-
  5       H  nXU   XS-      :*  -  n
M     O$[        US-
  5       H  nXU   XS-      :  -  n
M     [        U5       H  nXd   R                  U
5      Xd'   M     [        R                  " US5      $ s  snf s  snf )
aD  

Compute combinations of length r of the given tensor. The behavior is similar to python's itertools.combinations
when with_replacement is set to False, and itertools.combinations_with_replacement when with_replacement is set to True.

Args:
    x (Tensor): 1-D input Tensor, the data type is float16, float32, float64, int32 or int64.
    r (int, optional):  number of elements to combine, default value is 2.
    with_replacement (bool, optional):  whether to allow duplication in combination, default value is False.
    name (str|None, optional): Name for the operation (optional, default is None).For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor). Tensor concatenated by combinations, same dtype with x.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> x = paddle.to_tensor([1, 2, 3], dtype='int32')
        >>> res = paddle.combinations(x)
        >>> print(res)
        Tensor(shape=[3, 2], dtype=int32, place=Place(gpu:0), stop_gradient=True,
               [[1, 2],
                [1, 3],
                [2, 3]])

r/   z%Expect a 1-D vector, but got x shape r   z%Expect a non-negative int, but got r=)ro   r   r   r   Tr   )rn   ro   rl   rg   rk   r   rx   r  r   rj   meshgridnumelrH  r  masked_selectstack)rr   rwith_replacementr   rr  t_lgridsnum_elementst_rangeindex_gridsmasks              rt   combinationsrH    s   B 177|q?yIJJaQ@DEEAv||1#QWW551u(#(Qq(#$779LmmL8G1u %a)1w)ooc*i;;qww{D7Dq1uANka%&888D  q1uAN[Q%777D 1X8))$/  <<q!!+ $ *s   G3Gc                   [        U [        R                  [        [        R                  R
                  45      (       d  [        S[        U 5       35      e[        U S/ SQS5        S/[        R                  " U R                  5      -  n[        R                  " X R                  5      R                  U R                  5      n[        R                  " X 5      n[        R                   " U5      n [        R"                  " U S:  SS9nU$ )	a  
Tests if each element of input has its sign bit set or not.

Args:
    x (Tensor): The input Tensor. Must be one of the following types: float16, float32, float64, bfloat16, uint8, int8, int16, int32, int64.
    name (str|None, optional): Name for the operation (optional, default is None).For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor): The output Tensor. The sign bit of the corresponding element of the input tensor, True means negative, False means positive.

Examples:
    .. code-block:: python
        :name: signbit-example-1

        >>> import paddle
        >>> paddle.set_device('cpu')
        >>> x = paddle.to_tensor([-0., 1.1, -2.1, 0., 2.5], dtype='float32')
        >>> res = paddle.signbit(x)
        >>> print(res)
        Tensor(shape=[5], dtype=bool, place=Place(cpu), stop_gradient=True,
        [True, False, True, False, False])

    .. code-block:: python
        :name: signbit-example-2

        >>> import paddle
        >>> paddle.set_device('cpu')
        >>> x = paddle.to_tensor([-5, -2, 3], dtype='int32')
        >>> res = paddle.signbit(x)
        >>> print(res)
        Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
        [True , True , False])
r  rr   )	r   r   r   r   r   r   r   r   r   signbitr9  r   r   r   )rg   rx   rc   r(   ry   r   rl   rm   r&   r  r  ro   r  r   r  r2  r   r2   )rr   r   r  
neg_zero_xr   s        rt   rJ  rJ  ?  s    D a&--6::3C3CDEE9$q'CDD	
	
 	  5499QWW%%DD''*22177;D)JJA
++a!e6
*CJrv   c                R   [        U [        R                  [        [        R                  R
                  45      (       d  [        S[        U 5       35      e[        U S/ SQS5        [        R                  " U 5      n[        R                  " U 5      ) n[        R                  " X#5      $ )ad  
Tests if each element of input is positive infinity or not.

Args:
    x (Tensor): The input Tensor. Must be one of the following types: bfloat16, float16, float32, float64, int8, int16, int32, int64, uint8.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor), The output Tensor. Each element of output indicates whether the input element is positive infinity or not.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> paddle.set_device('cpu')
        >>> x = paddle.to_tensor([-0., float('inf'), -2.1, -float('inf'), 2.5], dtype='float32')
        >>> res = paddle.isposinf(x)
        >>> print(res)
        Tensor(shape=[5], dtype=bool, place=Place(cpu), stop_gradient=True,
        [False, True, False, False, False])

r  rr   	r   r   r   r   r   r   r   r   r   isposinfrg   rx   rc   r(   ry   r   rl   rm   r&   r   rJ  logical_andrr   r   is_infrJ  s       rt   rN  rN  |  s    . a&--6::3C3CDEE9$q'CDD	
	
 	  \\!_F~~a  Gf..rv   c                P   [        U [        R                  [        [        R                  R
                  45      (       d  [        S[        U 5       35      e[        U S/ SQS5        [        R                  " U 5      n[        R                  " U 5      n[        R                  " X#5      $ )ad  
Tests if each element of input is negative infinity or not.

Args:
    x (Tensor): The input Tensor. Must be one of the following types: bfloat16, float16, float32, float64, int8, int16, int32, int64, uint8.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor), The output Tensor. Each element of output indicates whether the input element is negative infinity or not.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> paddle.set_device('cpu')
        >>> x = paddle.to_tensor([-0., float('inf'), -2.1, -float('inf'), 2.5], dtype='float32')
        >>> res = paddle.isneginf(x)
        >>> print(res)
        Tensor(shape=[5], dtype=bool, place=Place(cpu), stop_gradient=True,
        [False, False, False, True, False])

r  rr   rM  isneginfrO  rQ  s       rt   rT  rT    s    . a&--6::3C3CDEE9$q'CDD	
	
 	  \\!_FnnQGf..rv   c                   [        U [        R                  [        [        R                  R
                  45      (       d  [        S[        U 5       35      eU R                  nU[        R                  R                  R                  :H  =(       do    U[        R                  R                  R                  :H  =(       dA    U[        R                  R                  :H  =(       d    U[        R                  R                  :H  (       + nU(       a  [        R                  " U SS9$ [        R                   " [        R"                  " U 5      S5      $ )a  
Tests if each element of input is a real number or not.

Args:
    x (Tensor): The input Tensor.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor), The output Tensor. Each element of output indicates whether the input element is a real number or not.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> paddle.set_device('cpu')
        >>> x = paddle.to_tensor([-0., -2.1, 2.5], dtype='float32')
        >>> res = paddle.isreal(x)
        >>> print(res)
        Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
        [True, True, True])

        >>> x = paddle.to_tensor([(-0.+1j), (-2.1+0.2j), (2.5-3.1j)])
        >>> res = paddle.isreal(x)
        >>> print(res)
        Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
        [False, False, False])

        >>> x = paddle.to_tensor([(-0.+1j), (-2.1+0j), (2.5-0j)])
        >>> res = paddle.isreal(x)
        >>> print(res)
        Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
        [False, True, True])
r  r   r   r   )rg   rx   rc   r(   ry   r   rl   rm   r   r+   r   r   r  r  r   r  rC  imag)rr   r   r   is_real_dtypes       rt   isrealrX    s    D a&--6::3C3CDEE9$q'CDDGGE%%/// 	-DLL((333	-DMM+++	- DMM,,,	M 00<<A**rv   c                ~   [        U [        R                  [        [        R                  R
                  45      (       d  [        S[        U 5       35      e[        U S/ SQS5        [        R                  " U S:g  U [        R                  " U S5      5      n[        R                  " U[        R                  " [        R                  U R                  S95      n[        R                   " UR#                  5       U5      n[        R                  " [        R$                  " U5      ) U[        R                  " U S5      5      $ )	a  
Calculate the normalized sinc of ``x`` elementwise.

.. math::

    out_i =
    \left\{
    \begin{aligned}
    &1 & \text{ if $x_i = 0$} \\
    &\frac{\sin(\pi x_i)}{\pi x_i} & \text{ otherwise}
    \end{aligned}
    \right.

Args:
    x (Tensor): The input Tensor. Must be one of the following types: bfloat16, float16, float32, float64.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor), The Tensor of elementwise-computed normalized sinc result.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> paddle.set_device('cpu')
        >>> paddle.seed(100)
        >>> x = paddle.rand([2,3], dtype='float32')
        >>> res = paddle.sinc(x)
        >>> print(res)
        Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [[0.56691176, 0.93089867, 0.99977750],
         [0.61639023, 0.79618412, 0.89171958]])
r  rr   rY  sincr   #B;r   r9  )rg   rx   rc   r(   ry   r   rl   rm   r&   rB  r:  r   r  r  rG  r   r   r   r   rr   r   r  s      rt   rZ  rZ    s    D a&--6::3C3CDEE9$q'CDD		
 	
 ,,qAvq&"2"21g">
?C
//#v//qwwG
HC
--	3
'C<<c**C1A1A!S1IJJrv   c                   [        U [        R                  [        45      (       d  [	        S[        U 5       35      e[        U S/ SQS5        [        R                  " U S:g  U [        R                  " U S5      5        [        R                  " U [        R                  " [        R                  U R                  S95        [        R                  " U 5      n[        R                  " U 5        [        R                   " X5        [        R"                  " [        R$                  " U 5      ) U [        R                  " U S5      5      $ )	z
Inplace version of ``sinc`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_sinc`.
r  rr   rY  sinc_r   r[  r   r9  )rg   rx   rc   r(   rl   rm   r&   rM  r:  r  r  r  rG  r   clonerX   r  rB  r   r\  s      rt   r^  r^  B  s     a&--2339$q'CDD		
 	
 MM!q&!V--a9:
Q((@A
,,q/C
KKN
NN1<<a(!V-=-=a-EFFrv   elementstest_xtest_elementsc                R   [        U [        R                  [        [        R                  R
                  45      (       d  [        S[        U 5       35      e[        U[        R                  [        [        R                  R
                  45      (       d  [        S[        U5       35      e[        U S/ SQS5        [        US/ SQS5        Sn[        U R                  5      S:X  a  U R                  S/5      n S	n[        R                  " U R                  5      n[        R                  " UR                  5      nU[        R                  " US
5      S-  :  a  [        U R                  5      S:X  a  [        R                  " / SS9$ U R                  [!        U R                  5      SUR"                  -  -   5      nX:H  n	[!        [%        SUR"                  * S-
  S5      5      n
U	R'                  U
S9n	U(       a  U	) n	GOU R)                  5       nUR)                  5       nU(       GaC  [        R*                  " X/5      n[        R,                  " US	S9nX   n[        R.                  " USSS9n[1        5       (       dP  [        R2                  R5                  U[        R6                  " UR9                  5       S-
  5      USS USS :H  5      nOUSS USS :H  USS& U(       a  UR;                  5       n[        R<                  " U5      n[?        5       (       d"  [        R2                  R5                  UUU5      nOUUU'   USU R9                  5        R                  U R                  5      n	O[        R@                  " U5      n[        RB                  " UU5      n[        RD                  " UUR9                  5       :  U[        RF                  " US5      5      nUU   U:H  n	U(       a  U	R;                  5       OU	n	U	R                  U R                  5      n	U(       a  U	R                  / 5      $ U	$ )a"  
Tests if each element of `x` is in `test_x`.

.. note::
    Alias Support: The parameter name ``elements`` can be used as an alias for ``x``, and the parameter name ``test_elements`` can be used as an alias for ``test_x``.
    For example, ``isin(elements=tensor1, test_elements=tensor2)`` is equivalent to ``isin(x=tensor1, test_x=tensor2)``.

Args:
    x (Tensor): The input Tensor. Supported data type: 'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64'. alias: ``elements``.
    test_x (Tensor): Tensor values against which to test for each input element. Supported data type: 'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64'. alias: ``test_elements``.
    assume_unique (bool, optional): If True, indicates both `x` and `test_x` contain unique elements, which could make the calculation faster. Default: False.
    invert (bool, optional): Indicate whether to invert the boolean return tensor. If True, invert the results. Default: False.
    name (str|None, optional): Name for the operation (optional, default is None).For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor), The output Tensor with the same shape as `x`.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> paddle.set_device('cpu')
        >>> x = paddle.to_tensor([-0., -2.1, 2.5, 1.0, -2.1], dtype='float32')
        >>> test_x = paddle.to_tensor([-2.1, 2.5], dtype='float32')
        >>> res = paddle.isin(x, test_x)
        >>> print(res)
        Tensor(shape=[5], dtype=bool, place=Place(cpu), stop_gradient=True,
        [False, True, True, False, True])

        >>> x = paddle.to_tensor([-0., -2.1, 2.5, 1.0, -2.1], dtype='float32')
        >>> test_x = paddle.to_tensor([-2.1, 2.5], dtype='float32')
        >>> res = paddle.isin(x, test_x, invert=True)
        >>> print(res)
        Tensor(shape=[5], dtype=bool, place=Place(cpu), stop_gradient=True,
        [True, False, False, True, False])

        >>> # Set `assume_unique` to True only when `x` and `test_x` contain unique values, otherwise the result may be incorrect.
        >>> x = paddle.to_tensor([0., 1., 2.]*20).reshape([20, 3])
        >>> test_x = paddle.to_tensor([0., 1.]*20)
        >>> correct_result = paddle.isin(x, test_x, assume_unique=False)
        >>> print(correct_result)
        Tensor(shape=[20, 3], dtype=bool, place=Place(cpu), stop_gradient=True,
        [[True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False],
         [True , True , False]])

        >>> incorrect_result = paddle.isin(x, test_x, assume_unique=True)
        >>> print(incorrect_result)
        Tensor(shape=[20, 3], dtype=bool, place=Place(gpu:0), stop_gradient=True,
        [[True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , True ],
         [True , True , False]])

r  rr   )r   r   r   r   r   r   isinra  Fr   r/   Tg(\?g      $@r   r   )r/   r   rF  )stableNr   )$rg   rx   rc   r(   ry   r   rl   rm   r&   rn   ro   r  r  r  r   r  ri   ndimrj   r
   r  r  argsortr:  r,   r  r  rH  r=  rL  
empty_liker-   sortsearchsortedrB  rS  )rr   ra  assume_uniqueinvertr   
x_zero_dimsize_xsize_tr  cmpr  x_flattest_x_flatall_elementssorted_indexsorted_xduplicate_maskrG  sorted_test_xidxtest_idxs                        rt   rd  rd  _  sc   @ a&--6::3C3CDEE9$q'CDDfv}}h

8H8HIJJ9$v,HII		
 	 	
 	 J
177|qIIqcN
YYqwwFYYv||$F'$..qww<1<<&11iiagg$*<=>mE"v{{lQ.34gg3g$Cnn&!==&)>?L!>>,tDL#1H#--lEPN"$$!'!6!6"MM."6"6"81"<=QRLHSbM1" '/qrlhsm&Cs#!/!;!;!=$$^4D)++}},,T<P%3\"q1779%--agg6C #KK4M%%mV<C||m))++!!#w/H
  )V3C'-#//#3C++agg&C{{2
rv   c                4   U  H4  n[        UR                  5      S:w  d  M  [        SUR                   35      e   [        U 5      S:X  a  U S   $ [        R                  " [        R
                  " U 5      SS9n[        R                  " US[        U 5      /5      $ )a  
Perform Cartesian product on a given tensor sequence. This behavior is similar to the itertools.product in Python.
Equivalent to converting all input tensors into lists, performing itertools.product on these lists,
and finally converting the resulting list into tensors.

Args:
    x (list[Tensor]|tuple[Tensor]): Any number of 1-D input Tensors. Supported data types: bfloat16, float16, float32, float64, int32, int64, complex64 or complex128.
    name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    out (Tensor), cartesian product of input tensors with the same data type.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> a = paddle.to_tensor([1, 2, 3], dtype='int32')
        >>> b = paddle.to_tensor([5, 6], dtype='int32')
        >>> res = paddle.cartesian_prod([a, b])
        >>> print(res)
        Tensor(shape=[6, 2], dtype=int32, place=Place(cpu), stop_gradient=True,
        [[1, 5],
         [1, 6],
         [2, 5],
         [2, 6],
         [3, 5],
         [3, 6]])

        >>> c = paddle.to_tensor([7, 8, 9], dtype='float32')
        >>> res = paddle.cartesian_prod([c])
        >>> print(res)
        Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
        [7., 8., 9.])

        >>> d = paddle.empty([0], dtype='float64')
        >>> e = paddle.to_tensor([1, 2], dtype='float64')
        >>> f = paddle.to_tensor([3, 4, 5, 6, 7], dtype='float64')
        >>> res = paddle.cartesian_prod([d, e, f])
        >>> print(res)
        Tensor(shape=[0, 3], dtype=float64, place=Place(cpu), stop_gradient=True,
        [])
r/   z"Expect a 1D vector, but got shape r   r   rF  )rn   ro   r   rx   r?  r<  r  )rr   r   r  coordinatess       rt   cartesian_prodr|  "  s    V v||!4V\\NC   1v{t,,vq1;K>>+CF|44rv   )N)rr   rc   r   
str | Nonereturnrc   )r9  r   TNN)rr   rc   r   float | Tensorr   r   r   r   r   r}  r   r}  r~  rc   )gq=
ףp?gjMSt?N)
rr   rc   r   r   r   r   r   r}  r~  rc   )r   Sequence[Tensor]r   rc   r   r}  r~  rc   )rr   rc   r   r   r   r   r   r   r   r}  r   r}  r~  rc   )
rr   rc   r   r  r   r}  r   Tensor | Noner~  rc   )rr   rc   r   r  r   r}  r~  rc   )rr   rc   r   rc   r   r}  r   rb   r   r  r~  rc   )
rr   rc   r   rc   r   r}  r   rb   r~  rc   )rr   rc   r   rc   r   r}  r~  rc   )rr   rc   r   rc   r   r}  r   r}  r   r  r~  rc   )
rr   rc   r   rc   r   r}  r   r}  r~  rc   )r   rc   r   rc   r   r  r~  rc   )
rr   rc   r   zNumber | Tensorr   r}  r   r  r~  rc   )
rr   rc   r   rc   r   r}  r   r  r~  rc   )r   N	Undefined)r   N)rr   rc   r6  rc   r   r}  r~  rc   )r   NNN)rr   rc   rD  r   rE  float | NonerF  r  r   r}  r~  rc   )NNFN)rr   rc   rq   int | Sequence[int] | Noner   DTypeLike | NonerT  r   r   r}  r~  rc   )NFN)
rr   rc   rq   r  rT  r   r   r}  r~  rc   )r   zTensor | Sequence[Tensor]r   r}  r~  rc   )r   rc   r   r}  r~  rc   )r   rc   rx  rc   r   r}  r~  rc   )r9  r9  N)r   rc   rr   rc   r   rc   r  r   r   r   r   r}  r~  rc   )
rr   rc   r  r   rq   rk   r  r   r~  rc   )rr   rc   r   r}  r~  None)NNN)rr   rc   rA  r  r@  r  r   r}  r   r  r~  rc   )
rr   rc   rA  r  r@  r  r   r}  r~  rc   )r   r   r/   N)rr   rc   r  rk   r  rk   r  rk   r   r}  r~  rc   )rr   rc   rq   
int | Noner   r  r   r}  r   r  r~  rc   )
rr   rc   rq   r  r   r  r   r}  r~  rc   )Nr   N)
rr   rc   rq   r  r   rd   r   r}  r~  tuple[Tensor, Tensor])rr   rc   r  r  r   r  r   r  r   r}  r~  rc   )
rr   rc   r  r  r   r  r   r}  r~  rc   )NFNNN)rr   rc   rq   r  rT  r   r   r  r   r  r   r}  r~  rc   )r9  N)rr   rc   r  r   r   r}  r~  rc   )r  Sequence[int]r~  	list[int])r  r  r  r  r~  r  )rr   rc   r  rk   r   r}  r~  rc   )NN)rr   rc   rd  r  r   r}  r~  rc   )
rr   rc   r   rc   rj  r  r   r}  r~  rc   )r/   r   NNN)rr   rc   r  rk   rq   rk   r  r  r  r  r   r}  r   r  r~  rc   )rr   rc   r   r}  r   r  r~  rc   )r  N)
rr   rc   r   rc   r  z Literal['raise', 'wrap', 'clip']r   r}  r~  rc   )rr   rc   r   r}  r~  r  )NNr   r   )r   rc   rr   r  r  r  rq   rk   r  zLiteral['sum', 'cumsum']r~  rc   )NNr   N)r   rc   rr   r  r  r  rq   rk   r   r}  r~  rc   )
rr   rc   r  r  r  r   r   r}  r~  rc   )rr   rc   r  rk   r   r}  r~  rc   )TNN)rr   rc   r   rc   r  r   r   r  r   r}  r~  rc   )T)rr   rc   r   Tensor | intr  r   r~  rc   )rr   rc   r   r  r  r   )rr   rc   r   zTensor | floatr   r}  r~  rc   )r#   FN)
rr   rc   r@  rk   rA  r   r   r}  r~  rc   )FFN)rr   rc   ra  rc   rk  r   rl  r   r   r}  r~  rc   )rr   r  r   r}  r~  rc   (  
__future__r   r  r  r3  typingr   r   numpyr>  rx   r   paddle._C_opsr   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   paddle.base.libpaddler   paddle.common_ops_importr   r   
paddle.pirr   paddle.utils.decorator_utilsr   r   r    r!   paddle.utils.inplace_utilsr"   base.data_feederr$   r%   r&   r'   common_ops_importr(   	frameworkr)   r*   r+   r,   r-   r.   creationr0   layer_function_generatorr1   manipulationr2   r3   opsr4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   collections.abcra   rb   rc   paddle._typingrd   re   __all__r   UINT8INT8INT16r  r  _supported_int_dtype_FP32FP64_supported_float_dtype_ru   r}   r   r   r   r   r   r   r   OP_NAMEMAPPINGr   r   r   r   r   r   r   r  r  r   r	  r   r  r  	floor_modmod___doc__
floor_mod_r  r  r!  r%  r'  r*  r,  r/  r3  r5  rJ  rO  rR  rZ  r`  rb  r   rf  rj  r  r  r  r  r  r  r  r  r  r@  rA  r  r  r  r  r  r  r  r  r  r  r
  r  r  r  r  r  r  r"  r   r%  r(  r*  r-  r/  r1  r4  r6  r:  r<  r>  rM  rP  rS  rU  rX  rZ  r\  rc  rf  ri  rm  ro  rq  ru  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r	  r  r  r  r  r  r  r!  r&  r*  r.  r0  r2  r6  r8  r:  rH  rJ  rN  rT  rX  rZ  r^  rd  r|  r  rv   rt   <module>r     sx   #    )        * + ;   D  )  - 7 %. . . . . . . . . . . .` (( @
 OOOOOOOOOO  OOOO .
    !r-r-r- r- 	r-
 
r- r- r-n 	AAA A 	A
 AJ AE^^%+^3=^^B  !FFF F 	F
 
F F F F  G9J<89 Y
 YYY Y
 
Y Y :Yx L L ! (*!!"
F)R #w#w0 ^
 ^^^ ^
 ^ 
^ ^ 1^B #w#w0 $
 $$$ $
 $ $  1$,<~ #w#w0 [
 [[[ [
 [ 
[ [ 1[| #w#w0 )
 ))) )
 ) )  1), #w#w0 W
 !%WWW W
 W 
W W 1Wt #w#w0 
 !% 
    1D 	
)
)
) 
	
)
 
)  :P
 :P:P:P :P
 
:P :P :Pz 
& 
& #w#w0-1:KKO:K:K:K *:K;H:K:K 1:Kz 
# 
# 	 

  #w#w0-13KKO3K3K3K *3K;H3K3K 13Kl #w#w0"  1"4AAAA=L@=L@Ql SS	S S 	S
 S Sl    	    	 
      J (,"R7R7
$R7 R7 	R7
 R7 R7n (,	UU
$U U 	U
 Ut (,	IIII
$II II 	II
 IIXod&R $ $w| hhh h 	h
 h h hV 
 171717 17 	17
 17 17 17 17p CCC C 	C
 C C CL 
 G9G9G9 G9 	G9
 G9 G9 G9 G9T=@  *P)f G9F845 >
 >>> >
 
> > 6>B6r *$	 (,	\\
$\ \ 	\
 \\~ *$	 (,	NN
$N N 	N
 NNb           #w  	T TT	T 
T 	T 
T T !Tn  	))	) 
) 	)
 ) ). #w  ddd d 	d
 d d !dNBJ #w&%1 "	i# i#i#
i# i# 	i# 
i# i# 2i#X  "	>>
> > 	>
 > >8 	YY
Y Y 	Y
 Y| 	XX
X X 	X
 Xz "	aa
a a 	a
 aH #w  h #hh	h 	h
 
h h h !hV  "	55	5 5 	5
 5 5. #w&%1 (,"FF
$F F 	F
 
F F F 2FR  * *Z,^!2!2%2!2!2H7t F " "2j " "0f ' '&: 	 	2j ! !GB  :  BBK^ =AJJ J/9JJZ <@
%
% 
%/9
%
% 
% FJ999"098B99x EI&&&"0&8B&& &(3l  EP=@ #w#w0R 1Rj #w#w0( 1(V #w#w09 19x #w#w0 1& G9ug67 ! p pp
p p 	p
 p p 
p p 8pfEP/Ad #w "&9K@D9K9K9K0=9K9K !9Kx & &*5v .5	qqq +q 	q
 qh<B %*OOO 	O 	O
 #O Oh <2<2<2 	<2 	<2
 <2 <2B >5>5>5 	>5 	>5
 >5 >5F 	aaa a 	a
 aH!H)X  *Z&R'TC CL + +(32l3&B ??? ? 
	?
 ? ?D  ??? ? 
	?
 ? ? ?. @@@ @ 
	@
 @ @F  @@@ @ 
	@
 @ @ @0 ??? ? 	?" @@@ @ 	@" ??? ?" @@@ @Q Qh " "#L    "	?"?"
?" ?" 	?"
 ?"D:z,/^,/^.+b4Kn G G8 #z"X$?@    	
   AD55 55rv   