
    |jX.                       d dl mZ d dlmZ d dlmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZ d dlmZ ddlmZ ddlmZ ddlmZmZ d	d
lm Z m!Z! erd dl"m#Z# g dZ$g Z% e!d           e&            d<    e'e$          D ],Z( e e(          Z)e*e)_+         ee)          Z,e, e&            e(<   -dddZ-dddZ.dddZ/edd            Z0dddZ1dddZ2dddZ3dS )    )annotations)TYPE_CHECKING)absacosacoshasinatanhceilcoscoshexpexpm1floorroundrsqrtsigmoidsinsinhsqrt)inplace_apis_in_dygraph_only   )_C_ops)check_variable_and_dtype)LayerHelperin_dynamic_or_pir_mode   )generate_inplace_fngenerate_layer_fn)Tensor)exp_sqrt_rsqrt_ceil_floor_reciprocal_sigmoid_abs_sin_sinh_asin_asinh_cos_cosh_acos_acosh_tan_atan_atanh_expm1_erf_square_scale_scaleNxr   name
str | Nonereturnc                   t                      rt          j        |           S t          | dg dd           t	          d	i t                      }|                    | j                  }|                    dd| id|i           |S )
a  
    Asinh Activation Operator.

    .. math::
       out = asinh(x)

    Args:
        x (Tensor): Input of Asinh operator, an N-D Tensor, with data type float32, float64, float16, bfloat16,
            uint8, int8, int16, 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. Output of Asinh operator, a Tensor with shape same as 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.asinh(x)
            >>> print(out)
            Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
            [-0.39003533, -0.19869010,  0.09983408,  0.29567307])
    r8   float16uint16float32float64uint8int8int16int32int64	complex64
complex128asinhdtypeXOuttypeinputsoutputsN)rI   )	r   r   rI   r   r   locals"create_variable_for_type_inferencerK   	append_opr8   r9   helperouts       a/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/paddle/tensor/ops.pyrI   rI   Z   s    6  |A    !	
 	
 	
$ 111177ag7FFgsAhMMM
    c                   t                      rt          j        |           S t          | dg dd           t	          d	i t                      }|                    | j                  }|                    dd| id|i           |S )
ar  
    Arctangent Operator.

    .. math::
       out = tan^{-1}(x)

    Args:
        x (Tensor): Input of Atan operator, an N-D Tensor, with data type float32, float64, float16, bfloat16,
            uint8, int8, int16, 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. Same shape and dtype as input x
            (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.atan(x)
            >>> print(out)
            Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
            [-0.38050640, -0.19739556,  0.09966865,  0.29145682])
    r8   r=   atanrJ   rL   rM   rN   N)r[   )	r   r   r[   r   r   rR   rS   rK   rT   rU   s       rX   r[   r[      s    6  {1~~    !	
 	
 	
$ 00vxx0077ag7FFfc1Xs|LLL
rY   c                   t                      rt          j        |           S t          | dg dd           t	          d	i t                      }|                    | j                  }|                    dd| id|i           |S )
a  

    Reciprocal Activation Operator.

    .. math::
        out = \frac{1}{x}

    Args:
        x (Tensor): Input of Reciprocal operator, an N-D Tensor, with data type float32, float64, float16, 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:
        Tensor. Output of Reciprocal operator, a Tensor with shape same as 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.reciprocal(x)
            >>> print(out)
            Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
            [-2.50000000, -5.        ,  10.       ,  3.33333325])
    r8   )	r>   r?   r@   rA   rB   rC   rD   rE   rF   
reciprocalrJ   rL   rM   rN   N)r]   )	r   r   r]   r   r   rR   rS   rK   rT   rU   s       rX   r]   r]      s    8   ### 
 
 
 	
 	
 	
  66VXX6677ag7FFsAh 	 	
 	
 	
 
rY   c                ,    t          j        | |          S )z
    Inplace version of ``round`` API, the output Tensor will be inplaced with input ``x``.
    Please refer to :ref:`api_paddle_round`.
    )r   round_)r8   decimalsr9   s      rX   r_   r_      s     =H%%%rY   c                   t                      rt          j        |           S t          | dg dd           t	          d	i t                      }|                    | j                  }|                    dd| id|i           |S )
a4  
    Square each elements of the inputs.

    .. math::
       out = x^2

    Args:
        x (Tensor): Input of Square operator, an N-D Tensor, with data type int32, int64, float32, float64, float16, 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. Output of Square operator, a Tensor with shape same as input.

    Examples:
        .. code-block:: python

            >>> import paddle

            >>> x = paddle.to_tensor([-0.4, -0.2, 0.1, 0.3])
            >>> out = paddle.square(x)
            >>> print(out)
            Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
            [0.16000001, 0.04000000, 0.01000000, 0.09000000])
    r8   )rE   rF   r>   r@   rA   rG   rH   squarerJ   rL   rM   rN   N)rb   )	r   r   rb   r   r   rR   rS   rK   rT   rU   s       rX   rb   rb     s    2  }Q    	
 	
 	
 222277ag7FFhQx%NNN
rY   c                   t                      rt          j        |           S t          | dg dd           t	          d	i t                      }|                    | j                  }|                    dd| id|i           |S )
a  
    Tangent Operator. Computes tangent of x element-wise.

    Input range is `(k*pi-pi/2, k*pi+pi/2)` and output range is `(-inf, inf)`.

    .. math::
       out = tan(x)

    Args:
        x (Tensor): Input of Tan operator, an N-D Tensor, with data type float32, float64, float16,
            bfloat16, uint8, int8, int16, 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. Output of Tan operator, a Tensor with shape same as 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.tan(x)
            >>> print(out)
            Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
            [-0.42279324, -0.20271003,  0.10033467,  0.30933627])
    r8   r=   tanrJ   rL   rM   rN   N)rd   )	r   r   rd   r   r   rR   rS   rK   rT   rU   s       rX   rd   rd   6  s    :  z!}}    !	
 	
 	
$ //fhh//77ag7FFeS!HuclKKK
rY   c                    t                      rt          j        |           S t                                                      }i }|                                D ]\  }}||||<    t          d          di |S )a  
    The error function.
    For more details, see `Error function <https://en.wikipedia.org/wiki/Error_function>`_.

    Equation:
        ..  math::
            out = \frac{2}{\sqrt{\pi}} \int_{0}^{x}e^{- \eta^{2}}d\eta

    Args:
        x (Tensor): The input tensor, it's data type should be 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 output of Erf, dtype: float32 or float64 (integer types are autocasted into float32), shape: the same as the input.

    Examples:

        .. code-block:: python

            >>> import paddle

            >>> x = paddle.to_tensor([-0.4, -0.2, 0.1, 0.3])
            >>> out = paddle.erf(x)
            >>> print(out)
            Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
            [-0.42839241, -0.22270259,  0.11246292,  0.32862678])
    Nerf )r   r   rf   rR   copyitemsr   )r8   r9   
locals_varkwargsvals        rX   rf   rf   n  s    8  z!}}JF%%''  	c?F4L#U##--f---rY   )N)r8   r   r9   r:   r;   r   )r   N)4
__future__r   typingr   paddle._C_opsr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   paddle.utils.inplace_utilsr    r   base.data_feederr   	frameworkr   r   layer_function_generatorr   r   paddler   __inplace_unary_func____all__globalsset_OPfunc__name__
__module___funcrI   r[   r]   r_   rb   rd   rf   rg   rY   rX   <module>r      s   # " " " " "                                                 & D C C C C C       7 7 7 7 7 7 ; ; ; ; ; ; ; ;       
     2 
 ('00		( 3%&&  Cs##DDO((..EGGIIcNN3 3 3 3 3l3 3 3 3 3l4 4 4 4 4n & & & &- - - - -`5 5 5 5 5p$. $. $. $. $. $. $.rY   