o
    i es                     @   s  d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z
 ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZm Z  edej!ej"ej#ej$ej%ej&ej'ej(	Z)ej*ej+eddCdej,e) dej,e) dej,e) fddZ-ede.e-Z/e-j0j1Z2dej,e) dej,e) dej,e) fddZ3edej!ej"ej#ej$ej%ej&ej'ej(	Z4ej*ej+eddCdej,e4 dej,e4 dej,e4 fddZ5ede.e5Z6e5j0j1Z7dej,e4 dej,e4 dej,e4 fdd Z8ed!ej!ej"ej#ej$ej%ej&ej'ej(	Z9ej*ej+ed"dCdej,e9 dej,e9 dej,e9 fd#d$Z:ed%e.e:Z;e:j0j1Z<dej,e9 dej,e9 dej,e9 fd&d'Z=ed(ej!ej"ej#ej$ej%ej&ej'ej(	Z>ej*ej+ed)dCdej,e> dej,e> fd*d+Z?ed,e.e?Z@e?j0j1ZAdej,e> dej,e> fd-d.ZBed/ej!ej"ej#ej$ej%ej&ej'ej(	ZCej*ej+ed0dCdej,eC dej,eC dej,eC fd1d2ZDed3e.eDZEeDj0j1ZFdej,eC dej,eC dej,eC fd4d5ZGed6ej!ej"ej#ej$ej%ej&ej'ej(	ZHdCdej,eH dej,ej( fd7d8ZIed9e.eIZJdej,eH dej,ej( fd:d;ZKed<ej!ej"ej#ej$ej%ej&ej'ej(	ZLej*ej+ed=dCdej,eL dej,eL dej,eL fd>d?ZMed@e.eMZNeMj0j1ZOdej,eL dej,eL dej,eL fdAdBZPdS )DzUPython wrappers around TensorFlow ops.

This file is MACHINE GENERATED! Do not edit.
    N)
pywrap_tfe)context)core)execute)dtypes)annotation_types)op_def_registry)ops)op_def_library)deprecated_endpoints)dispatch)	tf_export)TypeVarListTV_BitwiseAnd_Tzbitwise.bitwise_andxyreturnc                 C     t j pt  }|j}|jr~zt|d|| |}|W S  tjy2 } zt	|| W Y d}~nd}~w tj
y;   Y nw zt| ||fd}|turL|W S t| |||dW S  tjy^   Y n. ttfy}   ttdt| ||d}|tjjur|| Y S  w t| ||fd}|tur|S ztjd| ||d\}}}}	W n  ttfy   ttdt| ||d}|tjjur| Y S  w |	dd }t rd|df}
|j}td||
| |\}|S )a  Elementwise computes the bitwise AND of `x` and `y`.

  The result will have those bits set, that are set in both `x` and `y`. The
  computation is performed on the underlying representations of `x` and `y`.

  For example:

  ```python
  import tensorflow as tf
  from tensorflow.python.ops import bitwise_ops
  dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64,
                tf.uint8, tf.uint16, tf.uint32, tf.uint64]

  for dtype in dtype_list:
    lhs = tf.constant([0, 5, 3, 14], dtype=dtype)
    rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
    exp = tf.constant([0, 0, 3, 10], dtype=tf.float32)

    res = bitwise_ops.bitwise_and(lhs, rhs)
    tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE
  ```

  Args:
    x: A `Tensor`. Must be one of the following types: `int8`, `int16`, `int32`, `int64`, `uint8`, `uint16`, `uint32`, `uint64`.
    y: A `Tensor`. Must have the same type as `x`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `x`.
  
BitwiseAndNnamectx r   r   r   T)_contextr   _thread_local_datais_eagerr   TFE_Py_FastPathExecute_core_NotOkStatusException_opsraise_from_not_ok_status_FallbackException_dispatcher_for_bitwise_andNotImplementedbitwise_and_eager_fallback_SymbolicException	TypeError
ValueError	_dispatchr   bitwise_anddictOpDispatcherNOT_SUPPORTED_op_def_library_apply_op_helper_executemust_record_gradient_get_attr_typeinputsrecord_gradientr   r   r   _ctxtld_resulte__op_outputs_attrs_inputs_flatr   r   T/var/www/myenv/lib/python3.10/site-packages/tensorflow/python/ops/gen_bitwise_ops.pyr,      v   "


r,   zraw_ops.BitwiseAndc           	      C      t | |g|tjtjtjtjtjtjtj	tj
g\}}|\} }| |g}d|f}t jdd||||d}t  r>t d||| |\}|S )Nr   s
   BitwiseAnd   r5   attrsr   r   r   r2   args_to_matching_eager_dtypesint8int16int32int64uint8uint16uint32uint64r   r3   r6   	r   r   r   r   _attr_T	_inputs_Tr@   r?   r:   r   r   rA   r'   t      6
r'   TV_BitwiseOr_Tzbitwise.bitwise_orc                 C   r   )a  Elementwise computes the bitwise OR of `x` and `y`.

  The result will have those bits set, that are set in `x`, `y` or both. The
  computation is performed on the underlying representations of `x` and `y`.

  For example:

  ```python
  import tensorflow as tf
  from tensorflow.python.ops import bitwise_ops
  dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64,
                tf.uint8, tf.uint16, tf.uint32, tf.uint64]

  for dtype in dtype_list:
    lhs = tf.constant([0, 5, 3, 14], dtype=dtype)
    rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
    exp = tf.constant([5, 5, 7, 15], dtype=tf.float32)

    res = bitwise_ops.bitwise_or(lhs, rhs)
    tf.assert_equal(tf.cast(res,  tf.float32), exp)  # TRUE
  ```

  Args:
    x: A `Tensor`. Must be one of the following types: `int8`, `int16`, `int32`, `int64`, `uint8`, `uint16`, `uint32`, `uint64`.
    y: A `Tensor`. Must have the same type as `x`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `x`.
  	BitwiseOrNr   r   r   r   )r   r   r   r   r   r   r    r!   r"   r#   r$   _dispatcher_for_bitwise_orr&   bitwise_or_eager_fallbackr(   r)   r*   r+   r   
bitwise_orr-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r   r   rA   rZ      rB   rZ   zraw_ops.BitwiseOrc           	      C   rC   )Nr   s	   BitwiseOrrD   rE   rW   rG   rR   r   r   rA   rY      rU   rY   TV_BitwiseXor_Tzbitwise.bitwise_xorc                 C   r   )a  Elementwise computes the bitwise XOR of `x` and `y`.

  The result will have those bits set, that are different in `x` and `y`. The
  computation is performed on the underlying representations of `x` and `y`.

  For example:

  ```python
  import tensorflow as tf
  from tensorflow.python.ops import bitwise_ops
  dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64,
                tf.uint8, tf.uint16, tf.uint32, tf.uint64]

  for dtype in dtype_list:
    lhs = tf.constant([0, 5, 3, 14], dtype=dtype)
    rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
    exp = tf.constant([5, 5, 4, 5],  dtype=tf.float32)

    res = bitwise_ops.bitwise_xor(lhs, rhs)
    tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE
  ```

  Args:
    x: A `Tensor`. Must be one of the following types: `int8`, `int16`, `int32`, `int64`, `uint8`, `uint16`, `uint32`, `uint64`.
    y: A `Tensor`. Must have the same type as `x`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `x`.
  
BitwiseXorNr   r   r   r   )r   r   r   r   r   r   r    r!   r"   r#   r$   _dispatcher_for_bitwise_xorr&   bitwise_xor_eager_fallbackr(   r)   r*   r+   r   bitwise_xorr-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r   r   rA   r_      rB   r_   zraw_ops.BitwiseXorc           	      C   rC   )Nr   s
   BitwiseXorrD   rE   r\   rG   rR   r   r   rA   r^   H  rU   r^   TV_Invert_Tzbitwise.invertc                 C   s  t j pt  }|j}|jrzzt|d|| }|W S  tjy1 } zt	|| W Y d}~nd}~w tj
y:   Y nw zt| |fd}|turJ|W S t| ||dW S  tjy[   Y n, ttfyy   ttdt| |d}|tjjurx| Y S  w t| |fd}|tur|S ztjd| |d\}}}}W n ttfy   ttdt| |d}|tjjur| Y S  w |dd }t rd|df}	|j}
td|
|	| |\}|S )a:  Invert (flip) each bit of supported types; for example, type `uint8` value 01010101 becomes 10101010.

  Flip each bit of supported types.  For example, type `int8` (decimal 2) binary 00000010 becomes (decimal -3) binary 11111101.
  This operation is performed on each element of the tensor argument `x`.

  Example:
  ```python
  import tensorflow as tf
  from tensorflow.python.ops import bitwise_ops

  # flip 2 (00000010) to -3 (11111101)
  tf.assert_equal(-3, bitwise_ops.invert(2))

  dtype_list = [dtypes.int8, dtypes.int16, dtypes.int32, dtypes.int64,
                dtypes.uint8, dtypes.uint16, dtypes.uint32, dtypes.uint64]

  inputs = [0, 5, 3, 14]
  for dtype in dtype_list:
    # Because of issues with negative numbers, let's test this indirectly.
    # 1. invert(a) and a = 0
    # 2. invert(a) or a = invert(0)
    input_tensor = tf.constant([0, 5, 3, 14], dtype=dtype)
    not_a_and_a, not_a_or_a, not_0 = [bitwise_ops.bitwise_and(
                                        input_tensor, bitwise_ops.invert(input_tensor)),
                                      bitwise_ops.bitwise_or(
                                        input_tensor, bitwise_ops.invert(input_tensor)),
                                      bitwise_ops.invert(
                                        tf.constant(0, dtype=dtype))]

    expected = tf.constant([0, 0, 0, 0], dtype=tf.float32)
    tf.assert_equal(tf.cast(not_a_and_a, tf.float32), expected)

    expected = tf.cast([not_0] * 4, tf.float32)
    tf.assert_equal(tf.cast(not_a_or_a, tf.float32), expected)

    # For unsigned dtypes let's also check the result directly.
    if dtype.is_unsigned:
      inverted = bitwise_ops.invert(input_tensor)
      expected = tf.constant([dtype.max - x for x in inputs], dtype=tf.float32)
      tf.assert_equal(tf.cast(inverted, tf.float32), tf.cast(expected, tf.float32))
  ```

  Args:
    x: A `Tensor`. Must be one of the following types: `int8`, `int16`, `int32`, `int64`, `uint8`, `uint16`, `uint32`, `uint64`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `x`.
  InvertNr   r   r   r   r   )r   r   r   r   r   r   r    r!   r"   r#   r$   _dispatcher_for_invertr&   invert_eager_fallbackr(   r)   r*   r+   r   invertr-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r   r   r8   r9   r:   r;   r<   r=   r>   r?   r@   r   r   rA   re   X  sv   5re   zraw_ops.Invertc                 C   |   t | g|tjtjtjtjtjtjtj	tj
g\}\} | g}d|f}t jdd||||d}t  r9t d||| |\}|S )Nr   s   InvertrD   rE   ra   rG   r   r   r   rS   r@   r?   r:   r   r   rA   rd     s   6rd   TV_LeftShift_Tzbitwise.left_shiftc                 C   r   )ak  Elementwise computes the bitwise left-shift of `x` and `y`.

  If `y` is negative, or greater than or equal to the width of `x` in bits the
  result is implementation defined.

  Example:

  ```python
  import tensorflow as tf
  from tensorflow.python.ops import bitwise_ops
  import numpy as np
  dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64]

  for dtype in dtype_list:
    lhs = tf.constant([-1, -5, -3, -14], dtype=dtype)
    rhs = tf.constant([5, 0, 7, 11], dtype=dtype)

    left_shift_result = bitwise_ops.left_shift(lhs, rhs)

    print(left_shift_result)

  # This will print:
  # tf.Tensor([ -32   -5 -128    0], shape=(4,), dtype=int8)
  # tf.Tensor([   -32     -5   -384 -28672], shape=(4,), dtype=int16)
  # tf.Tensor([   -32     -5   -384 -28672], shape=(4,), dtype=int32)
  # tf.Tensor([   -32     -5   -384 -28672], shape=(4,), dtype=int64)

  lhs = np.array([-2, 64, 101, 32], dtype=np.int8)
  rhs = np.array([-1, -5, -3, -14], dtype=np.int8)
  bitwise_ops.left_shift(lhs, rhs)
  # <tf.Tensor: shape=(4,), dtype=int8, numpy=array([ -2,  64, 101,  32], dtype=int8)>
  ```

  Args:
    x: A `Tensor`. Must be one of the following types: `int8`, `int16`, `int32`, `int64`, `uint8`, `uint16`, `uint32`, `uint64`.
    y: A `Tensor`. Must have the same type as `x`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `x`.
  	LeftShiftNr   r   r   r   )r   r   r   r   r   r   r    r!   r"   r#   r$   _dispatcher_for_left_shiftr&   left_shift_eager_fallbackr(   r)   r*   r+   r   
left_shiftr-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r   r   rA   rm     sv   -


rm   zraw_ops.LeftShiftc           	      C   rC   )Nr   s	   LeftShiftrD   rE   rj   rG   rR   r   r   rA   rl   9  rU   rl   TV_PopulationCount_Tc              
   C   s   t j pt  }|j}|jrNzt|d|| }|W S  tjy1 } zt	|| W Y d}~nd}~w tj
y:   Y nw zt| ||dW S  tjyM   Y nw tjd| |d\}}}}|dd }t rvd|df}	|j}
td|
|	| |\}|S )ax  Computes element-wise population count (a.k.a. popcount, bitsum, bitcount).

  For each entry in `x`, calculates the number of `1` (on) bits in the binary
  representation of that entry.

  **NOTE**: It is more efficient to first `tf.bitcast` your tensors into
  `int32` or `int64` and perform the bitcount on the result, than to feed in
  8- or 16-bit inputs and then aggregate the resulting counts.

  Args:
    x: A `Tensor`. Must be one of the following types: `int8`, `int16`, `int32`, `int64`, `uint8`, `uint16`, `uint32`, `uint64`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `uint8`.
  PopulationCountNr   rb   r   )r   r   r   r   r   r   r    r!   r"   r#   r$   population_count_eager_fallbackr(   r0   r1   r2   r3   r4   r5   r6   rf   r   r   rA   population_countI  sB   rq   zraw_ops.PopulationCountc                 C   rg   )Nr   s   PopulationCountrD   rE   ro   rG   rh   r   r   rA   rp   y  s   6
rp   TV_RightShift_Tzbitwise.right_shiftc                 C   r   )a  Elementwise computes the bitwise right-shift of `x` and `y`.

  Performs a logical shift for unsigned integer types, and an arithmetic shift
  for signed integer types.

  If `y` is negative, or greater than or equal to than the width of `x` in bits
  the result is implementation defined.

  Example:

  ```python
  import tensorflow as tf
  from tensorflow.python.ops import bitwise_ops
  import numpy as np
  dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64]

  for dtype in dtype_list:
    lhs = tf.constant([-1, -5, -3, -14], dtype=dtype)
    rhs = tf.constant([5, 0, 7, 11], dtype=dtype)

    right_shift_result = bitwise_ops.right_shift(lhs, rhs)

    print(right_shift_result)

  # This will print:
  # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int8)
  # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int16)
  # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int32)
  # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int64)

  lhs = np.array([-2, 64, 101, 32], dtype=np.int8)
  rhs = np.array([-1, -5, -3, -14], dtype=np.int8)
  bitwise_ops.right_shift(lhs, rhs)
  # <tf.Tensor: shape=(4,), dtype=int8, numpy=array([ -2,  64, 101,  32], dtype=int8)>
  ```

  Args:
    x: A `Tensor`. Must be one of the following types: `int8`, `int16`, `int32`, `int64`, `uint8`, `uint16`, `uint32`, `uint64`.
    y: A `Tensor`. Must have the same type as `x`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `x`.
  
RightShiftNr   r   r   r   )r   r   r   r   r   r   r    r!   r"   r#   r$   _dispatcher_for_right_shiftr&   right_shift_eager_fallbackr(   r)   r*   r+   r   right_shiftr-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r   r   rA   rv     sv   0


rv   zraw_ops.RightShiftc           	      C   rC   )Nr   s
   RightShiftrD   rE   rs   rG   rR   r   r   rA   ru     rU   ru   )N)Q__doc__collectionstensorflow.pythonr   tensorflow.python.eagerr   r   r   r    r   r2   tensorflow.python.frameworkr   rI   tensorflow.security.fuzzing.pyr   _atypesr   _op_def_registryr	   r"   r
   r0   "tensorflow.python.util.deprecationr   tensorflow.python.utilr   r+    tensorflow.python.util.tf_exportr   typingr   r   Int16Int32Int64Int8UInt16UInt32UInt64UInt8r   add_fallback_dispatch_listadd_type_based_api_dispatcherTensorFuzzingAnnotationr,   	to_raw_opr   _tf_type_based_dispatcherDispatchr%   r'   rV   rZ   rW   rX   rY   r[   r_   r\   r]   r^   r`   re   ra   rc   rd   ri   rm   rj   rk   rl   rn   rq   ro   rp   rr   rv   rs   rt   ru   r   r   r   rA   <module>   s    (0S((0S((0S((&f(0^(("- (0a,