
    ёik                    &   S SK Jr  S SKJrJr  S SKJ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  S SKJr  S SKJr  S S	K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#  \(       a  S SKJ$r$  / r%   S;             S<S jjr&\S=S>S jj5       r'\S=S>S jj5       r(\S=S>S jj5       r)\S=S?S jj5       r*S=S?S jjr+S=S>S jjr,    S@             SAS jjr-\" SS/SS/5       S=SS.         SBS jjj5       r.\S=S>S jj5       r/\" SS/SS/5       S=SS.         SBS jjj5       r0\" SS/SS/5       S=SS.         SBS  jjj5       r1\S=S>S! jj5       r2\S=S>S" jj5       r3\" SS/SS/5       S=SS.         SBS# jjj5       r4\S=S>S$ jj5       r5\" SS/SS/5       S=SS.         SBS% jjj5       r6\S=S>S& jj5       r7\S=S>S' jj5       r8\" SS/SS/5       S=SS.         SBS( jjj5       r9\S=S>S) jj5       r:\" SS*/5      SCS+ j5       r;   S;             S<S, jjr< SD         SES- jjr=SFS. jr>\S=S>S/ jj5       r?\" SS/SS/5       SD         SES0 jj5       r@  SD         SGS1 jjrA\\" S/S/S2.5      S=S>S3 jj5       5       rB SD         SES4 jjrC  SD         SGS5 jjrD\S=S>S6 jj5       rE SD       SHS7 jjrF\S=S?S8 jj5       rG SD       SHS9 jjrH\S=S?S: jj5       rIg)I    )annotations)TYPE_CHECKINGAny)	TypeGuardN)_C_ops)greater_thaniscloselogical_andlogical_not
logical_orlogical_xor)full)broadcast_shape)ParamAliasDecoratorparam_one_aliasparam_two_alias)inplace_apis_in_dygraph_only   )
check_typecheck_variable_and_dtype)Variable)LayerHelperin_dynamic_modein_dynamic_or_pir_modein_pir_mode)Tensorxyc                   [        5       (       a'  [        [        U 5      nU(       a  U" X5      $ U" U5      $ [        US/ SQU 5        Ub  [        US/ SQU 5        Ub  [	        US[
        U 5        [        U 40 [        5       D6nUc  UR                  UR                  S9nU(       a  UR                  XUS.SU0S9  U$ UR                  U S	U0SU0S9  U$ )
Nr   )boolint8int16int32int64float16float32float64uint16	complex64
complex128r   outdtypeXYOuttypeinputsoutputsr/   )r   getattrr   r   r   r   r   locals"create_variable_for_type_inferencer-   	append_opop_namer   r   r+   name	binary_opophelpers           S/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/paddle/tensor/logic.py_logical_oprA   7   s     VW%a8Oa5L  !	
$ =$ !$ ?sE8W5W11;;;!'';JC1%5s|   
	 c1Xs|   
    c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``logical_and`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_logical_and`.
The shape of broadcast output * is different from that of inplace tensor  in the Inplace operation.N)r   shape
ValueErrorr   r   logical_and_r   r   r<   	out_shapes       r@   rI   rI      s      1IGG,YK7abcbibiaj  kE  F
 	
 ""1(( rB   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``logical_or`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_logical_or`.
rD   rE   rF   N)r   rG   rH   r   r   logical_or_rJ   s       r@   rN   rN      s      1IGG,YK7abcbibiaj  kE  F
 	
 !!!'' rB   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``logical_xor`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_logical_xor`.
rD   rE   rF   N)r   rG   rH   r   r   logical_xor_rJ   s       r@   rQ   rQ      rL   rB   c                N    [        5       (       a  [        R                  " U 5      $ g)z
Inplace version of ``logical_not`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_logical_not`.
N)r   r   logical_not_r   r<   s     r@   rS   rS      #     ""1%% rB   c                t   [        5       (       a  [        R                  " U 5      $ [        U S/ SQS5        [	        US[
        [        S5      4S5        [        5       (       a  [        R                  " U 5      $ [        S0 [        5       D6nUR                  SS9nSUl        UR                  SS	U /0S
U/0S9  U$ )ao  

Test whether a Tensor is empty.

Args:
    x (Tensor): The Tensor to be tested.
    name (str|None, optional): The default value is ``None`` . Normally users don't have to set this parameter. For more information, please refer to :ref:`api_guide_Name` .

Returns:
    Tensor: A bool scalar Tensor. True if 'x' is an empty Tensor.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> input = paddle.rand(shape=[4, 32, 32], dtype='float32')
        >>> res = paddle.is_empty(x=input)
        >>> print(res)
        Tensor(shape=[], dtype=bool, place=Place(cpu), stop_gradient=True,
        False)

r   )r&   r'   r#   r$   is_emptyr<   Nr    r,   Tr/   r1   r2   )rW   )r   r   rW   r   r   strr3   r   r   r7   r8   stop_gradientr9   )r   r<   r?   conds       r@   rW   rW      s    0 q!!	38* tVc4:.
;}}q!!468488v8F!S1#J 	 	
 rB   c                    [        5       (       a  [        R                  " X5      $ [        S0 [	        5       D6nUR                  SS9nUR                  SU /U/S.SU/0S9  U$ )a@  
Returns the truth value of :math:`x == y`. True if two inputs have the same elements, False otherwise.

Note:
    The output has no gradient.

Args:
    x(Tensor): Tensor, data type is bool, float32, float64, int32, int64.
    y(Tensor): Tensor, data type is bool, float32, float64, int32, int64.
    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: output Tensor, data type is bool, value is [False] or [True].

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([1, 2, 3])
        >>> y = paddle.to_tensor([1, 2, 3])
        >>> z = paddle.to_tensor([1, 4, 3])
        >>> result1 = paddle.equal_all(x, y)
        >>> print(result1)
        Tensor(shape=[], dtype=bool, place=Place(cpu), stop_gradient=True,
        True)
        >>> result2 = paddle.equal_all(x, z)
        >>> print(result2)
        Tensor(shape=[], dtype=bool, place=Place(cpu), stop_gradient=True,
        False)
	equal_allr    r,   r.   r1   r2   )r\   )r   r   r\   r   r7   r8   r9   )r   r   r<   r?   r+   s        r@   r\   r\      ss    B %%5FH577f7EA3'SEN 	 	

 
rB   c                p   [        5       (       a  [        R                  " XX#U5      $ [        5       (       a  [	        U S/ SQS5        [	        US/ SQS5        [        U[        [        R                  R                  45      (       d  [        S[        U5       35      e[        U[        [        R                  R                  45      (       d  [        S[        U5       35      e[        US[        S5        [        R                  " XX#U5      $ [	        U S/ SQS5        [	        US/ SQS5        [        US[        S5        [        US[        S5        [        US[        S5        [        S0 [        5       D6nUR!                  S	S
9nXS.nSU0n	[#        U5      [#        U5      US.n
UR%                  SXU
S9  U$ )a.  
Check if all :math:`x` and :math:`y` satisfy the condition:

.. math::
    \left| x - y \right| \leq atol + rtol \times \left| y \right|

elementwise, for all elements of :math:`x` and :math:`y`. This is analogous to :math:`numpy.allclose`, namely that it returns :math:`True` if
two tensors are elementwise equal within a tolerance.

Args:
    x (Tensor): The input tensor, it's data type should be float16, float32, float64.
    y (Tensor): The input tensor, it's data type should be float16, float32, float64.
    rtol (float, optional): The relative tolerance. Default: :math:`1e-5` .
    atol (float, optional): The absolute tolerance. Default: :math:`1e-8` .
    equal_nan (bool, optional): ${equal_nan_comment}. Default: False.
    name (str|None, optional): Name for the operation. For more information, please
        refer to :ref:`api_guide_Name`. Default: None.

Returns:
    Tensor: The output tensor, it's data type is bool.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([10000., 1e-07])
        >>> y = paddle.to_tensor([10000.1, 1e-08])
        >>> result1 = paddle.allclose(x, y, rtol=1e-05, atol=1e-08, equal_nan=False, name="ignore_nan")
        >>> print(result1)
        Tensor(shape=[], dtype=bool, place=Place(cpu), stop_gradient=True,
        False)
        >>> result2 = paddle.allclose(x, y, rtol=1e-05, atol=1e-08, equal_nan=True, name="equal_nan")
        >>> print(result2)
        Tensor(shape=[], dtype=bool, place=Place(cpu), stop_gradient=True,
        False)
        >>> x = paddle.to_tensor([1.0, float('nan')])
        >>> y = paddle.to_tensor([1.0, float('nan')])
        >>> result1 = paddle.allclose(x, y, rtol=1e-05, atol=1e-08, equal_nan=False, name="ignore_nan")
        >>> print(result1)
        Tensor(shape=[], dtype=bool, place=Place(cpu), stop_gradient=True,
        False)
        >>> result2 = paddle.allclose(x, y, rtol=1e-05, atol=1e-08, equal_nan=True, name="equal_nan")
        >>> print(result2)
        Tensor(shape=[], dtype=bool, place=Place(cpu), stop_gradient=True,
        True)
input)r    r#   r$   r%   r&   r'   allclosez4Type of input rtol must be float, but received type z4Type of input atol must be float, but received type 	equal_nanrtolatolr    r,   )InputOtherr1   )ra   rb   r`   )r3   r4   r5   attrs)r_   )r   r   r_   r   r   
isinstancefloatpaddlepirValue	TypeErrorr3   r   r    r   r7   r8   rX   r9   )r   r   ra   rb   r`   r<   r?   r+   r4   r5   re   s              r@   r_   r_     s   p qT;;	 G		
 	!G		
 $

(8(8 9::FtDzlS  $

(8(8 9::FtDzlS  	9k4<qT;; G		
 	!G		
 	4
34
39k4<468477f7E)#,TCIINF5 	 	
 
rB   r^   otherr+   c          	        [        U[        [        [        [        [
        [        R                  R                  45      (       d  [        S[        U5       35      e[        U[        [        R                  R                  [
        45      (       d  [        / U R                  US9n[        U[
        5      (       a  [        R                  " U5      n[        5       (       a  [        R                   " XUS9$ [#        U S/ SQS5        [#        US/ SQS5        [%        S0 ['        5       D6nUR)                  SS	9nS
Ul        UR-                  SU /U/S.SU/0S9  U$ )a  

This layer returns the truth value of :math:`x == y` elementwise.

Note:
    The output has no gradient.

Args:
    x (Tensor): Tensor, data type is bool, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        alias: ``input``
    y (Tensor): Tensor, data type is bool, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        alias: ``other``
    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`.
    out (Tensor, optional): Output tensor. If provided, the result will be stored in this tensor.

Returns:
    Tensor: output Tensor, it's shape is the same as the input's Tensor,
    and the data type is bool. The result of this op is stop_gradient.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([1, 2, 3])
        >>> y = paddle.to_tensor([1, 3, 2])
        >>> result1 = paddle.equal(x, y)
        >>> print(result1)
        Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
        [True , False, False])
zRType of input args must be float, bool, complex, int or Tensor, but received type )rG   r-   
fill_valuerm   r   r    r%   r&   r'   uint8r!   r"   r#   r$   r(   r)   r*   equalr   r    r,   Tr.   r1   r2   )rr   )rf   intr    rg   r   complexrh   ri   rj   rk   r3   r   r-   	to_tensorr   r   rr   r   r   r7   r8   rY   r9   r   r   r<   r+   r?   s        r@   rr   rr   ~  sH   H 	Cuh1A1AB  `aefgah`ij
 	
 a(FJJ$4$4g>??rQ7!WQ||Ac**  #	
& 	! #	
& 1177f7E A3'SEN 	 	

 
rB   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``equal`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_equal`.
rD   rE   rF   N)r   rG   rH   r   r   equal_rJ   s       r@   rx   rx     sq      1IGG,YK7abcbibiaj  kE  F
 	
 }}Q""  rB   c               `    [        5       (       a  [        R                  " XUS9$ [        S5      e)a  
Returns the truth value of :math:`x > y` elementwise, which is equivalent function to the overloaded operator `>`.

Note:
    The output has no gradient.

Args:
    x (Tensor): First input to compare which is N-D tensor. The input data type should be bool, bfloat16, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        Alias: ``input``.
    y (Tensor): Second input to compare which is N-D tensor. The input data type should be bool, bfloat16, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        Alias: ``other``.
    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`.
    out (Tensor, optional): The output tensor. If provided, the result will be stored in this tensor.

Returns:
    Tensor: The output shape is same as input :attr:`x`. The output data type is bool.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([1, 2, 3])
        >>> y = paddle.to_tensor([1, 3, 2])
        >>> result1 = paddle.gt(x, y)
        >>> print(result1)
        Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
        [False, False, True ])
rm   z.paddle.gt does not support legacy static mode.)r   r   r   NotImplementedError)r   r   r<   r+   s       r@   gtr{     s1    D ""1S11!<
 	
rB   c                  [        5       (       a  [        R                  " XUS9$ [        U S/ SQS5        [        US/ SQS5        [	        S0 [        5       D6nUR                  SS9nSUl        UR                  SU /U/S	.S
U/0S9  U$ )a2  
Returns the truth value of :math:`x >= y` elementwise, which is equivalent function to the overloaded operator `>=`.

Note:
    The output has no gradient.

Args:
    x (Tensor): First input to compare which is N-D tensor. The input data type should be bool, bfloat16, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        Alias: ``input``.
    y (Tensor): Second input to compare which is N-D tensor. The input data type should be bool, bfloat16, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        Alias: ``other``.
    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`.
    out (Tensor, optional): The output tensor. If set, the result will be stored in this tensor. Default is None.
Returns:
    Tensor: The output shape is same as input :attr:`x`. The output data type is bool.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([1, 2, 3])
        >>> y = paddle.to_tensor([1, 3, 2])
        >>> result1 = paddle.greater_equal(x, y)
        >>> print(result1)
        Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
        [True , False, True ])
rm   r   rp   greater_equalr   r    r,   Tr.   r1   r2   )r}   )	r   r   r}   r   r   r7   r8   rY   r9   rv   s        r@   r}   r}     s    B ##Ac22  #	
& 	! #	
& 9977f7E  A3'SEN 	 	

 
rB   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``greater_equal`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_greater_equal`.
rD   rE   rF   N)r   rG   rH   r   r   greater_equal_rJ   s       r@   r   r   t  ss      1IGG,YK7abcbibiaj  kE  F
 	
 $$Q** rB   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``greater_than`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_greater_than`.
rD   rE   rF   N)r   rG   rH   r   r   greater_than_rJ   s       r@   r   r     ss      1IGG,YK7abcbibiaj  kE  F
 	
 ##A)) rB   c                  [        5       (       a  [        R                  " XUS9$ [        U S/ SQS5        [        US/ SQS5        [	        S0 [        5       D6nUR                  SS9nSUl        UR                  SU /U/S	.S
U/0S9  U$ )a0  
Returns the truth value of :math:`x <= y` elementwise, which is equivalent function to the overloaded operator `<=`.

Note:
    The output has no gradient.

Args:
    x (Tensor): First input to compare which is N-D tensor. The input data type should be bool, bfloat16, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        Alias: ``input``.
    y (Tensor): Second input to compare which is N-D tensor. The input data type should be bool, bfloat16, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        Alias: ``other``.
    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`.
    out (Tensor, optional): The output tensor. If set, the result will be stored in this tensor. Default is None.

Returns:
    Tensor: The output shape is same as input :attr:`x`. The output data type is bool.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([1, 2, 3])
        >>> y = paddle.to_tensor([1, 3, 2])
        >>> result1 = paddle.less_equal(x, y)
        >>> print(result1)
        Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
        [True , True , False])
rm   r   rp   
less_equalr   r    r,   Tr.   r1   r2   )r   )	r   r   r   r   r   r7   r8   rY   r9   rv   s        r@   r   r     s    D   3//  #	
& 	! #	
& 6VX677f7E A3'SEN 	 	

 
rB   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``less_equal`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_less_equal`.
rD   rE   rF   N)r   rG   rH   r   r   less_equal_rJ   s       r@   r   r     rO   rB   c                  [        5       (       a  [        R                  " XUS9$ [        U S/ SQS5        [        US/ SQS5        [	        S0 [        5       D6nUR                  SS9nSUl        UR                  SU /U/S	.S
U/0S9  U$ )a+  
Returns the truth value of :math:`x < y` elementwise, which is equivalent function to the overloaded operator `<`.

Note:
    The output has no gradient.

Args:
    x (Tensor): First input to compare which is N-D tensor. The input data type should be bool, bfloat16, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        Alias: ``input``
    y (Tensor): Second input to compare which is N-D tensor. The input data type should be bool, bfloat16, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        Alias: ``other``
    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`.
    out (Tensor, optional): The output tensor. If set, the result will be stored in this tensor. Default is None.

Returns:
    Tensor: The output shape is same as input :attr:`x`. The output data type is bool.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([1, 2, 3])
        >>> y = paddle.to_tensor([1, 3, 2])
        >>> result1 = paddle.less_than(x, y)
        >>> print(result1)
        Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
        [False, True , False])
rm   r   rp   	less_thanr   r    r,   Tr.   r1   r2   )r   )	r   r   r   r   r   r7   r8   rY   r9   rv   s        r@   r   r         D #..  #	
& 	! #	
& 5FH577f7E A3'SEN 	 	

 
rB   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``less_than`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_less_than`.
rD   rE   rF   N)r   rG   rH   r   r   
less_than_rJ   s       r@   r   r   N  s      1IGG,YK7abcbibiaj  kE  F
 	
   && rB   c                    [        XU5      $ )z
Inplace version of ``less_`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_less`.
)r   )r   r   r<   s      r@   less_r   ]  s     aD!!rB   c                  [        5       (       a  [        R                  " XUS9$ [        U S/ SQS5        [        US/ SQS5        [	        S0 [        5       D6nUR                  SS9nSUl        UR                  SU /U/S	.S
U/0S9  U$ )a/  
Returns the truth value of :math:`x != y` elementwise, which is equivalent function to the overloaded operator `!=`.

Note:
    The output has no gradient.

Args:
    x (Tensor): First input to compare which is N-D tensor. The input data type should be bool, bfloat16, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        Alias: ``input``.
    y (Tensor): Second input to compare which is N-D tensor. The input data type should be bool, bfloat16, float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128.
        Alias: ``other``.
    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`.
    out (Tensor, optional): The output tensor. If set, the result will be stored in this tensor. Default is None.

Returns:
    Tensor: The output shape is same as input :attr:`x`. The output data type is bool.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> x = paddle.to_tensor([1, 2, 3])
        >>> y = paddle.to_tensor([1, 3, 2])
        >>> result1 = paddle.not_equal(x, y)
        >>> print(result1)
        Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
        [False, True , True ])
rm   r   rp   	not_equalr   r    r,   Tr.   r1   r2   )r   )	r   r   r   r   r   r7   r8   rY   r9   rv   s        r@   r   r   h  r   rB   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``not_equal`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_not_equal`.
rD   rE   rF   N)r   rG   rH   r   r   
not_equal_rJ   s       r@   r   r     r   rB   objc                    [        5       (       a4  [        U [        R                  [        R                  R
                  45      $ [        U [        5      $ )a  

Tests whether input object is a paddle.Tensor.

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

Args:
    x (object): Object to test. alias: ``obj``.

Returns:
    A boolean value. True if ``x`` is a paddle.Tensor, otherwise False.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> input1 = paddle.rand(shape=[2, 3, 5], dtype='float32')
        >>> check = paddle.is_tensor(input1)
        >>> print(check)
        True

        >>> input3 = [1, 4]
        >>> check = paddle.is_tensor(input3)
        >>> print(check)
        False

)r   rf   rh   r   ri   rj   r   )r   s    r@   	is_tensorr     s;    @ !fmmVZZ-=-=>??!X&&rB   c                   [        5       (       a'  [        [        U 5      nU(       a  U" X5      $ U" U5      $ [        US/ SQU 5        Ub  [        US/ SQU 5        Ub  [	        US[
        U 5        [        U 40 [        5       D6nU(       a  UR                  UR                  :X  d   eUc  UR                  UR                  S9nU(       a  UR                  XUS.SU0S9  U$ UR                  U S	U0SU0S9  U$ )
Nr   )r    rq   r!   r"   r#   r$   r   r+   r,   r.   r1   r2   r/   )r   r6   r   r   r   r   r   r7   r-   r8   r9   r:   s           r@   _bitwise_opr     s    VW%a8Oa5L @		
 =$D	 ?sE8W5W1177agg%%%;;;!'';JC1%5s|   
	 c1Xs|   
rB   c           	     j    [        5       (       a  Uc  [        R                  " X5      $ [        SXX2SS9$ )a+  

Apply ``bitwise_and`` on Tensor ``X`` and ``Y`` .

.. math::
    Out = X \& Y

Note:
    ``paddle.bitwise_and`` 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_and`` . It is a N-D Tensor of bool, uint8, int8, int16, int32, int64.
    y (Tensor): Input Tensor of ``bitwise_and`` . It is a N-D Tensor of bool, uint8, int8, int16, int32, int64.
    out (Tensor|None, optional): Result of ``bitwise_and`` . 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_and`` . It is a N-D Tensor with the same data type of input Tensor.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> x = paddle.to_tensor([-5, -1, 1])
        >>> y = paddle.to_tensor([4,  2, -3])
        >>> res = paddle.bitwise_and(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [0, 2, 1])
bitwise_andTr;   r   r   r<   r+   r=   )r   r   r   r   r   r   r+   r<   s       r@   r   r   &  9    H CK!!!''dt rB   c                    [        U[        [        45      (       a+  [        R                  " XR
                  S9n[        X S S 5      $ [        S[        U5      R                   S35      e)Nr,   $unsupported operand type(s) for |: '' and 'Tensor')
rf   rs   r    rh   ru   r-   r   rk   r3   __name__)r   r   y_tensors      r@   __rand__r   Q  sZ    !c4[!!##AWW58d332473C3C2DNS
 	
rB   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``bitwise_and`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_bitwise_and`.
rD   rE   rF   N)r   rG   rH   r   r   bitwise_and_rJ   s       r@   r   r   [  ss      1IGG,YK7abcbibiaj  kE  F
 	
 ""1((  rB   c           	     j    [        5       (       a  Uc  [        R                  " X5      $ [        SXX2SS9$ )aj  

Apply ``bitwise_or`` on Tensor ``X`` and ``Y`` .

.. math::
    Out = X | Y

Note:
    ``paddle.bitwise_or`` 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

.. 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, ``bitwise_or(input=tensor_x, other=tensor_y, ...)`` is equivalent to ``bitwise_or(x=tensor_x, y=tensor_y, ...)``.

Args:
    x (Tensor): Input Tensor of ``bitwise_or`` . It is a N-D Tensor of bool, uint8, int8, int16, int32, int64.
        alias: ``input``.
    y (Tensor): Input Tensor of ``bitwise_or`` . It is a N-D Tensor of bool, uint8, int8, int16, int32, int64.
        alias: ``oth``.
    out (Tensor|None, optional): Result of ``bitwise_or`` . 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_or`` . It is a N-D Tensor with the same data type of input Tensor.

Examples:
    .. code-block:: python

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

bitwise_orTr   )r   r   r   r   r   s       r@   r   r   j  s9    V CK  &&Td rB   c                    [        U[        [        45      (       a(  [        R                  " XR
                  S9n[        XX#S9$ [        S[        U5      R                   S35      eNr,   r+   r<   r   r   )
rf   rs   r    rh   ru   r-   r   rk   r3   r   r   s       r@   __ror__r     sZ     !c4[!!Qgg.!C332473C3C2DNS
 	
rB   )r   r   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``bitwise_or`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_bitwise_or`.
rD   rE   rF   N)r   rG   rH   r   r   bitwise_or_rJ   s       r@   r   r     ss      1IGG,YK7abcbibiaj  kE  F
 	
 !!!'' rB   c           	     j    [        5       (       a  Uc  [        R                  " X5      $ [        SXX2SS9$ )a3  

Apply ``bitwise_xor`` on Tensor ``X`` and ``Y`` .

.. math::
    Out = X ^\wedge Y

Note:
    ``paddle.bitwise_xor`` 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_xor`` . It is a N-D Tensor of bool, uint8, int8, int16, int32, int64.
    y (Tensor): Input Tensor of ``bitwise_xor`` . It is a N-D Tensor of bool, uint8, int8, int16, int32, int64.
    out (Tensor|None, optional): Result of ``bitwise_xor`` . 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_xor`` . It is a N-D Tensor with the same data type of input Tensor.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> x = paddle.to_tensor([-5, -1, 1])
        >>> y = paddle.to_tensor([4,  2, -3])
        >>> res = paddle.bitwise_xor(x, y)
        >>> print(res)
        Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [-1, -3, -4])
bitwise_xorTr   )r   r   r   r   r   s       r@   r   r     r   rB   c                    [        U[        [        45      (       a(  [        R                  " XR
                  S9n[        XX#S9$ [        S[        U5      R                   S35      er   )
rf   rs   r    rh   ru   r-   r   rk   r3   r   r   s       r@   __rxor__r     sZ     !c4[!!Qgg.1S442473C3C2DNS
 	
rB   c                    [        U R                  UR                  5      nX0R                  :w  a  [        SU SU R                   S35      e[        5       (       a  [        R
                  " X5      $ g)z
Inplace version of ``bitwise_xor`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_bitwise_xor`.
rD   rE   rF   N)r   rG   rH   r   r   bitwise_xor_rJ   s       r@   r   r     rL   rB   c           	     l    [        5       (       a  Uc  [        R                  " U 5      $ [        SU SX!SS9$ )a  

Apply ``bitwise_not`` on Tensor ``X``.

.. math::
    Out = \sim X

Note:
    ``paddle.bitwise_not`` 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_not`` . It is a N-D Tensor of bool, uint8, int8, int16, int32, int64.
    out (Tensor|None, optional): Result of ``bitwise_not`` . 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_not`` . It is a N-D Tensor with the same data type of input Tensor.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> x = paddle.to_tensor([-5, -1, 1])
        >>> res = paddle.bitwise_not(x)
        >>> print(res)
        Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
        [ 4,  0, -2])
Nbitwise_notFr   )r   r   r   r   r   r+   r<   s      r@   r   r     s;    D CK!!!$$d% rB   c                N    [        5       (       a  [        R                  " U 5      $ g)z
Inplace version of ``bitwise_not`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_bitwise_not`.
N)r   r   bitwise_not_rT   s     r@   r   r   /  rU   rB   c                    [        XUS9$ )a&  
Apply ``bitwise_not`` (bitwise inversion) on Tensor ``x``.

This is an alias to the ``paddle.bitwise_not`` function.

.. math::
    Out = \sim X

Note:
    ``paddle.bitwise_invert`` is functionally equivalent to ``paddle.bitwise_not``.

Args:
    x (Tensor): Input Tensor of ``bitwise_invert``. It is a N-D Tensor of bool, uint8, int8, int16, int32, int64.
    out (Tensor|None, optional): Result of ``bitwise_invert``. It is a N-D Tensor with the same data type as the input Tensor. Default: None.
    name (str|None, optional): The default value is None. This property is typically not set by the user.
        For more information, please refer to :ref:`api_guide_Name`.

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

Examples:
    .. code-block:: python

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

r   )r   r   s      r@   bitwise_invertr   9  s    F q--rB   c                    [        XS9$ )z
Inplace version of ``bitwise_invert`` API, the output Tensor will be inplaced with input ``x``.
Please refer to :ref:`api_paddle_bitwise_invert_`.
)r<   )r   rT   s     r@   bitwise_invert_r   _  s     %%rB   )NNT)r;   rX   r   r   r   Tensor | Noner+   r   r<   
str | Noner=   r    returnr   )N)r   r   r   r   r<   r   r   r   )r   r   r<   r   r   r   )gh㈵>g:0yE>FN)r   r   r   r   ra   rg   rb   rg   r`   r    r<   r   r   r   )
r   r   r   r   r<   r   r+   r   r   r   )r   r   r   zTypeGuard[Tensor])NN)
r   r   r   r   r+   r   r<   r   r   r   )r   r   r   
int | bool)
r   r   r   r   r+   r   r<   r   r   r   )r   r   r+   r   r<   r   r   r   )J
__future__r   typingr   r   typing_extensionsr   rh   r   paddle._C_opsr   r	   r
   r   r   r   paddle.tensor.creationr   paddle.tensor.mathr   paddle.utils.decorator_utilsr   r   r   paddle.utils.inplace_utilsr   base.data_feederr   r   common_ops_importr   	frameworkr   r   r   r   r   __all__rA   rI   rN   rQ   rS   rW   r\   r_   rr   rx   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    rB   r@   <module>r      s   # % '    ( . 
 D C (  
 EEE E 
	E
 E E EP ) ) ( ( ) ) & &(V+b lll l 	l
 l l l^ #w#w0-1aKOaaa *a;Haa 1aH # #" #w#w0-1&
KO&
&
&
 *&
;H&
&
 1&
R #w#w0-1QKOQQQ *Q;HQQ 1Qh + + * * #w#w0-1RKORRR *R;HRR 1Rj ( ( #w#w0-1SKOSSS *S;HSS 1Sl ' ' " " #w#w0-1SKOSSS *S;HSS 1Sl ' ' #u"' "'R /// / 
	/
 / / /f IM(((,(;E((V
 ) ) #w#w0HL///,/;E// 1/j 	


 

 	

 
 G9G956( 7 ( IM(((,(;E((\ 	


 

 	

 
 ) ) >B''!'0:''T & & >B#.#.!#.0:#.#.L & &rB   