
    BVhp                         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	  G d	 d
 ej                  d
d            Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zy)z)Operators specific to slicing operations.    N)dtypes)tensor_util)gen_array_ops)gen_string_ops)list_ops)tensor_array_opsc                       e Zd Zy)GetItemOptsN)__name__
__module____qualname__     \/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/autograph/operators/slices.pyr
   r
      s    r   r
   element_dtypec                    t        |t              sJ t        | t        j                        rt	        | |      S t        j                  |       rx| j                  t        j                  k(  rt        | ||      S | j                  t        j                  k(  r%| j                  j                  dk(  rt        | |      S t        | |      S t!        | |      S )a  The slice read operator (i.e. __getitem__).

  Note: it is unspecified whether target will be mutated or not. In general,
  if target is mutable (like Python lists), it will be mutated.

  Args:
    target: An entity that supports getitem semantics.
    i: Index to read from.
    opts: A GetItemOpts object.

  Returns:
    The read element.

  Raises:
    ValueError: if target is not of a supported type.
  r   )
isinstancer
   r   TensorArray_tf_tensorarray_get_itemr   
is_tf_typedtyper   variant_tf_tensor_list_get_itemstringshapendims_tf_tensor_string_get_item_tf_tensor_get_item_py_get_item)targetioptss      r   get_itemr$   "   s    " 
D+	&&	&(445#FA..f%||v~~%%fa66		&6<<+=+=+B'22 ++""r   c                 $    | j                  |      S )z4Overload of get_item that stages a TensorArray read.)readr!   r"   s     r   r   r   B   s    	Qr   c                 x    |j                   t        d      t        j                  | ||j                         }|S )z4Overload of get_item that stages a Tensor list read.zacannot retrieve from a list without knowing its element type; use set_element_type to annotate itr   )r   
ValueErrorr   tensor_list_get_item)r!   r"   r#   xs       r   r   r   G   sB    	
 I J J##FAT=O=OP!	
(r   c                     | |   S )zAOverload of get_item that stages a Tensor (not Tensor list) read.r   r'   s     r   r   r   P       	r   c                 4    t        j                  | |d      }|S )z6Overload of get_item that stages a Tensor string read.   )r   substrr!   r"   r+   s      r   r   r   U   s    FAq)!	
(r   c                     | |   S )z>Overload of get_item that executes a Python list modification.r   r'   s     r   r    r    [   r-   r   c                    t        | t        j                        rt        | ||      S t	        j
                  |       r7| j                  t        j                  k(  rt        | ||      S t        | ||      S t        | ||      S )a  The slice write operator (i.e. __setitem__).

  Note: it is unspecified whether target will be mutated or not. In general,
  if target is mutable (like Python lists), it will be mutated.

  Args:
    target: An entity that supports setitem semantics.
    i: Index to modify.
    x: The new element value.

  Returns:
    Same as target, after the update was performed.

  Raises:
    ValueError: if target is not of a supported type.
  )r   r   r   _tf_tensorarray_set_itemr   r   r   r   r   _tf_tensor_list_set_item_tf_tensor_set_item_py_set_itemr1   s      r   set_itemr8   `   so    " (445#FAq11f%||v~~%%fa33 A..1%%r   c                 &    | j                  ||      S )z5Overload of set_item that stages a TensorArray write.)writer1   s      r   r4   r4   |   s    	a	r   c                 0    t        j                  | ||      S )z6Overload of set_item that stages a Tensor list update.)r   tensor_list_set_itemr1   s      r   r5   r5      s    		&	&vq!	44r   c                 6    t        j                  | |ff|f      S )z9Overload of set_item that stages a Tensor scatter update.)r   tensor_scatter_updater1   s      r   r6   r6      s    		,	,VqdWqd	CCr   c                     || |<   | S )z>Overload of set_item that executes a Python list modification.r   r1   s      r   r7   r7      s    &)	-r   )__doc__collectionstensorflow.python.frameworkr   r   tensorflow.python.opsr   r   r   r   
namedtupler
   r$   r   r   r   r   r    r8   r4   r5   r6   r7   r   r   r   <module>rE      su    0  . 3 / 0 * 2(+((8JK #@


&8
5
D
r   