
    AVh                       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 m!Z! ddl"m#Z#  ed Z$dde#e!ejJ                  f   de#e!e$f   fdZ&  ed       ejN                  e&            Z(de#e!ejJ                  f   de#e!e$f   fdZ) ed Z*dde#e!ejJ                  f   de#e!e*f   fdZ+  ed       ejN                  e+            Z,de#e!ejJ                  f   de#e!e*f   fdZ- ed Z.dde#e!ejJ                  f   de#e!e.f   de/fdZ0  ed       ejN                  e0            Z1de#e!ejJ                  f   de#e!e.f   de/fdZ2dd e#e!ejf                  f   fd!Z4  ed"       ejN                  e4            Z5d e#e!ejf                  f   fd#Z6dde#e!ejJ                  f   d$e/fd%Z7  ed&       ejN                  e7            Z8de#e!ejJ                  f   d$e/fd'Z9dde#e!ejJ                  f   fd(Z:  ed)       ejN                  e:            Z;de#e!ejJ                  f   fd*Z<dd+e#e!ejJ                  f   d,e#e!ejf                  f   fd-Z=  ed.       ejN                  e=            Z>d+e#e!ejJ                  f   d,e#e!ejf                  f   fd/Z?dd1e@d2e@d,e#e!ejJ                  f   fd3ZA  ed4       ejN                  eA            ZBd1e@d2e@d,e#e!ejJ                  f   fd5ZC ed6 ZDdde#e!ejJ                  f   d7eDd,e#e!eDf   fd8ZE  ed9       ejN                  eE            ZFde#e!ejJ                  f   d7eDd,e#e!eDf   fd:ZG ed; ZH ed<d=d>      ZIdde#e!ejJ                  f   d?e#e!eIf   d7eHd@eJdAe/d,e#e!eHf   fdBZK  edC       ejN                  eK            ZLde#e!ejJ                  f   d?e#e!eIf   d7eHd@eJdAe/d,e#e!eHf   fdDZM edE ZN edFd=d>      ZOdde#e!ejJ                  f   d?e#e!eOf   d7eNd,e#e!eNf   fdGZP  edH       ejN                  eP            ZQde#e!ejJ                  f   d?e#e!eOf   d7eNd,e#e!eNf   fdIZR edJdKdLdMdNdOdPdQd=d>dRdSdTdUdVdWdXdYdZd[      ZS ed\d=d>      ZTdde#e!ejJ                  f   d?e#e!eTf   d]e#e!eSf   fd^ZU  ed_       ejN                  eU            ZVde#e!ejJ                  f   d?e#e!eTf   d]e#e!eSf   fd`ZW edadKdLdMdNdOdPdQd=d>dRdSdTdUdVdWdXdYdZd[      ZX edbd=d>      ZYdde#e!ejJ                  f   d?e#e!eYf   d]e#e!eXf   fdcZZ  edd       ejN                  eZ            Z[de#e!ejJ                  f   d?e#e!eYf   d]e#e!eXf   fdeZ\ edfdKdLdMdNdOdPdQd=d>dRdSdTdUdVdWdXdYdZd[      Z] edgd=d>      Z^dde#e!ejJ                  f   d?e#e!e^f   d]e#e!e]f   fdhZ_  edi       ejN                  e_            Z`de#e!ejJ                  f   d?e#e!e^f   d]e#e!e]f   fdjZa edkdKdLdMdNdOdPdQd=d>dRdSdTdUdVdWdXdYdZd[      Zb edld=d>      Zcdde#e!ejJ                  f   d?e#e!ecf   d]e#e!ebf   fdmZd  edn       ejN                  ed            Zede#e!ejJ                  f   d?e#e!ecf   d]e#e!ebf   fdoZf edpdKdLdMdNdOdPdQd=d>dRdSdTdUdVdWdXdYdZd[      Zg edqd=d>      Zhdde#e!ejJ                  f   d?e#e!ehf   d]e#e!egf   fdrZi  eds       ejN                  ei            Zjde#e!ejJ                  f   d?e#e!ehf   d]e#e!egf   fdtZk edudKdLdMdNdOdPdQd=d>dRdSdTdUdVdWdXdYdZd[      Zl edvd=d>      Zmdde#e!ejJ                  f   d?e#e!emf   d]e#e!elf   fdwZn  edx       ejN                  en            Zode#e!ejJ                  f   d?e#e!emf   d]e#e!elf   fdyZp edz Zq ed{d=d>      Zrdde#e!ejJ                  f   d?e#e!erf   d]e#e!eqf   fd|Zs  ed}       ejN                  es            Ztde#e!ejJ                  f   d?e#e!erf   d]e#e!eqf   fd~Zu ed Zvd0d0d0g dfd7evd1e@d2e@de@d,e#e!ejJ                  f   f
dZw  ed       ejN                  ew            Zxd7evd1e@d2e@de@d,e#e!ejJ                  f   f
dZydde#e!ejJ                  f   d,e#e!ej                  f   fdZ{  ed       ejN                  e{            Z|de#e!ejJ                  f   d,e#e!ej                  f   fdZ} edd=d>      Z~ej                  dfde#e!ejJ                  f   de~d,e#e!e~f   fdZ  ed       ejN                  e            Zde#e!ejJ                  f   de~d,e#e!e~f   fdZy)zUPython 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Any)	Annotated) TV_AssignAddVariableOp_dtype_atypes.BFloat16_atypes.Bool_atypes.Complex128_atypes.Complex64_atypes.Float16_atypes.Float32_atypes.Float64_atypes.Float8e4m3b11fnuz_atypes.Float8e4m3fn_atypes.Float8e4m3fnuz_atypes.Float8e5m2_atypes.Float8e5m2fnuz_atypes.Half_atypes.Int16_atypes.Int32_atypes.Int4_atypes.Int64_atypes.Int8_atypes.QInt16_atypes.QInt32_atypes.QInt8_atypes.QUInt16_atypes.QUInt8_atypes.Resource_atypes.String_atypes.UInt16_atypes.UInt32_atypes.UInt4_atypes.UInt64_atypes.UInt8_atypes.Variantresourcevaluec                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| |      }|S t        j                  d| ||      \  }}}}	|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||      S # t        j                  $ r Y w xY w)a  Adds a value to the current value of a variable.

  Any ReadVariableOp with a control dependency on this op is guaranteed to
  see the incremented value or a subsequent newer one.

  Args:
    resource: A `Tensor` of type `resource`.
      handle to the resource in which to store the variable.
    value: A `Tensor`. the value by which the variable will be incremented.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  AssignAddVariableOpNnamectxr3   r4   r8   )_contextr   _thread_local_datais_eagerr   TFE_Py_FastPathExecute_core_NotOkStatusException_opsraise_from_not_ok_status_FallbackException%assign_add_variable_op_eager_fallback_SymbolicException_op_def_library_apply_op_helper
r3   r4   r8   _ctxtld_resulte__op_outputss
             _/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/ops/gen_resource_variable_ops.pyassign_add_variable_oprQ           
			0h..0$#\\11#T8U<gn (88DJ!QX	* && -
##At,,## 
2
E$0 0## 
0    A; ;CB))CCC C+*C+zraw_ops.AssignAddVariableOpc                     t        j                  |g|g       \  }\  }t        j                  | t        j
                        } | |g}d|f}t        j                  dd||||      }d }|S )Ndtypes   AssignAddVariableOpr   inputsattrsr9   r8   _executeargs_to_matching_eagerrA   convert_to_tensor_dtypesr3   r   r3   r4   r8   r9   _attr_dtype_inputs_flat_attrsrK   s           rP   rD   rD   A   s    "995'3K+x##Hg.>.>?(E",[!&3Q|#)s?''	.    ) TV_AssignSubVariableOp_dtyper   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   r1   r2   c                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| |      }|S t        j                  d| ||      \  }}}}	|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||      S # t        j                  $ r Y w xY w)a  Subtracts a value from the current value of a variable.

  Any ReadVariableOp with a control dependency on this op is guaranteed to
  see the decremented value or a subsequent newer one.

  Args:
    resource: A `Tensor` of type `resource`.
      handle to the resource in which to store the variable.
    value: A `Tensor`. the value by which the variable will be incremented.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  AssignSubVariableOpNr7   r:   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   %assign_sub_variable_op_eager_fallbackrE   rF   rG   rH   s
             rP   assign_sub_variable_oprh   N   rR   rS   zraw_ops.AssignSubVariableOpc                     t        j                  |g|g       \  }\  }t        j                  | t        j
                        } | |g}d|f}t        j                  dd||||      }d }|S )NrU   s   AssignSubVariableOpr   rV   rY   r^   s           rP   rg   rg   t   rb   rc   ) TV_AssignVariableOp_dtyper   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   r1   r2   validate_shapec           	         t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| |d|      }|S |d}t        j                  |d      }t        j                   d| |||      \  }}}	}
|	S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y w xY w)a  Assigns a new value to a variable.

  Any ReadVariableOp with a control dependency on this op is guaranteed to return
  this value or a subsequent newer value of the variable.

  Args:
    resource: A `Tensor` of type `resource`.
      handle to the resource in which to store the variable.
    value: A `Tensor`. the value to set the new tensor to use.
    validate_shape: An optional `bool`. Defaults to `False`.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  AssignVariableOprk   N)rk   r8   r9   F)r3   r4   rk   r8   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   !assign_variable_op_eager_fallbackrE   rZ   	make_boolrF   rG   )r3   r4   rk   r8   rI   rJ   rK   rL   rM   rN   rO   s              rP   assign_variable_oprp      s     
			0h..0$#\\11 $%9Ig n N%%n6FG.'88XU+9F!QX 
*! && -
##At,,## 
.
E.tO O## 
s0    B C+CCC#C3 3D	D	zraw_ops.AssignVariableOpc                 
   |d}t        j                  |d      }t        j                  |g|g       \  }\  }t        j                  | t
        j                        } | |g}d|d|f}t        j                  dd||||      }d }|S )NFrk   rU   s   AssignVariableOpr   rV   )rZ   ro   r[   rA   r\   r]   r3   r   )	r3   r4   rk   r8   r9   r_   r`   ra   rK   s	            rP   rn   rn      s    N%%n6FG."995'3K+x##Hg.>.>?(E",["2NC&0!L#)s?''	.rc   
mutex_lockc                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d||       }|S t        j                  d| |      \  }}}}|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||      S # t        j                  $ r Y w xY w)a  This op consumes a lock created by `MutexLock`.

  This op exists to consume a tensor created by `MutexLock` (other than
  direct control dependencies).  It should be the only that consumes the tensor,
  and will raise an error if it is not.  Its only purpose is to keep the
  mutex lock tensor alive until it is consumed by this op.

  **NOTE**: This operation must run on the same device as its input.  This may
  be enforced via the `colocate_with` mechanism.

  Args:
    mutex_lock: A `Tensor` of type `variant`.
      A tensor returned by `MutexLock`.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  ConsumeMutexLockNr7   )rr   r8   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   !consume_mutex_lock_eager_fallbackrE   rF   rG   )	rr   r8   rI   rJ   rK   rL   rM   rN   rO   s	            rP   consume_mutex_lockrv      s    & 
			0h..0$#\\11 $
4gn (88z>!QX	* && -
##At,,## 
.
4T+ +## 
0    A9 9C B''C ?C C C('C(zraw_ops.ConsumeMutexLockc                     t        j                  | t        j                        } | g}d }t	        j
                  dd||||      }d }|S )Ns   ConsumeMutexLockr   rV   )rA   r\   r]   variantrZ   r   )rr   r8   r9   r`   ra   rK   s         rP   ru   ru      sL    %%j'//B*,&0!L#)s?''	.rc   ignore_lookup_errorc                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| d|      }|S |d}t        j                  |d      }t        j                   d| ||      \  }}}}	|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||      S # t        j                  $ r Y w xY w)a  Deletes the resource specified by the handle.

  All subsequent operations using the resource will result in a NotFound
  error status.

  Args:
    resource: A `Tensor` of type `resource`. handle to the resource to delete.
    ignore_lookup_error: An optional `bool`. Defaults to `True`.
      whether to ignore the error when the resource
      doesn't exist.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  DestroyResourceOprz   N)rz   r8   r9   T)r3   rz   r8   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   "destroy_resource_op_eager_fallbackrE   rZ   ro   rF   rG   )
r3   rz   r8   rI   rJ   rK   rL   rM   rN   rO   s
             rP   destroy_resource_opr~      s     
			0h..0$#\\11!43Hg n   **+>@UV'88h1D"&(!QX 
*% && -
##At,,## 
/
(;$  ## 
s0    B C)CCC!C0 0DDzraw_ops.DestroyResourceOpc                     |d}t        j                  |d      }t        j                  | t        j
                        } | g}d|f}t        j                  dd||||      }d }|S )NTrz   s   DestroyResourceOpr   rV   )rZ   ro   rA   r\   r]   r3   r   )r3   rz   r8   r9   r`   ra   rK   s          rP   r}   r}     su      **+>@UV##Hg.>.>?(,!#67&11\#)s?''	.rc   c                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d||       }|S t        j                  d| |      \  }}}}|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||      S # t        j                  $ r Y w xY w)ab  Turns off the copy-on-read mode.

  Turns off the copy-on-read mode of a resource variable. If the variable is not in copy-on-read mode, this op has no effect.

  Args:
    resource: A `Tensor` of type `resource`.
      The resource handle of the resource variable.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  DisableCopyOnReadNr7   r3   r8   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   #disable_copy_on_read_eager_fallbackrE   rF   rG   )	r3   r8   rI   rJ   rK   rL   rM   rN   rO   s	            rP   disable_copy_on_readr   *  s     
			0h..0$#\\11!43gn (88hT;!QX	* && -
##At,,## 
0
4) )## 
rw   zraw_ops.DisableCopyOnReadc                     t        j                  | t        j                        } | g}d }t	        j
                  dd||||      }d }|S )Ns   DisableCopyOnReadr   rV   )rA   r\   r]   r3   rZ   r   r3   r8   r9   r`   ra   rK   s         rP   r   r   N  sN    ##Hg.>.>?(,&11\#)s?''	.rc   mutexreturnc                 \   t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d||       }|S t        j                  d| |      \  }}}}|dd }t        j                          r&d}	|j"                  }
t        j$                  d|
|	|       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||      S # t        j                  $ r Y w xY w)aJ  Locks a mutex resource.  The output is the lock.  So long as the lock tensor

  is alive, any other request to use `MutexLock` with this mutex will wait.

  This is particularly useful for creating a critical section when used in
  conjunction with `MutexLockIdentity`:

  ```python

  mutex = mutex_v2(
    shared_name=handle_name, container=container, name=name)

  def execute_in_critical_section(fn, *args, **kwargs):
    lock = gen_resource_variable_ops.mutex_lock(mutex)

    with ops.control_dependencies([lock]):
      r = fn(*args, **kwargs)

    with ops.control_dependencies(nest.flatten(r)):
      with ops.colocate_with(mutex):
        ensure_lock_exists = mutex_lock_identity(lock)

      # Make sure that if any element of r is accessed, all of
      # them are executed together.
      r = nest.map_structure(tf.identity, r)

    with ops.control_dependencies([ensure_lock_exists]):
      return nest.map_structure(tf.identity, r)
  ```

  While `fn` is running in the critical section, no other functions which wish to
  use this critical section may run.

  Often the use case is that two executions of the same graph, in parallel,
  wish to run `fn`; and we wish to ensure that only one of them executes
  at a time.  This is especially important if `fn` modifies one or more
  variables at a time.

  It is also useful if two separate functions must share a resource, but we
  wish to ensure the usage is exclusive.

  Args:
    mutex: A `Tensor` of type `resource`. The mutex resource to lock.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  	MutexLockNr7   )r   r8    )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   mutex_lock_eager_fallbackrE   rF   rG   rZ   must_record_gradientrW   record_gradient)r   r8   rI   rJ   rK   rL   rM   rN   rO   ra   r`   s              rP   rr   rr   X  s(   b 
			0h..0$#\\11k4(gn (885t-!QXQK'""$F::L\674('	.' && -
##At,,## 
&
d& &## 
0    B< <DC**DDD D+*D+zraw_ops.MutexLockc                     t        j                  | t        j                        } | g}d }t	        j
                  dd||||      }t	        j                         rt	        j                  d|||       |\  }|S )Ns	   MutexLock   rV   r   rA   r\   r]   r3   rZ   r   r   r   )r   r8   r9   r`   ra   rK   s         rP   r   r     sr    

 
 (8(8
9%,&\1\#)s?'""$\674('	.rc    	containershared_namec           	         t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|d| d|      }|S | d} t        j                  | d      } |d}t        j                  |d      }t        j                   d| ||      \  }}}}	|	dd }t        j"                         rHd|j%                  d      d|j%                  d      f}
|j&                  }t        j(                  d||
|       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||      S # t        j                  $ r Y )w xY w)a  Creates a Mutex resource that can be locked by `MutexLock`.

  Args:
    container: An optional `string`. Defaults to `""`.
      If non-empty, this variable is placed in the given container.
      Otherwise, a default container is used.
    shared_name: An optional `string`. Defaults to `""`.
      If non-empty, this variable is named in the given bucket
      with this shared_name. Otherwise, the node name is used instead.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  MutexV2r   r   N)r   r   r8   r9   r   )r   r   r8   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   mutex_v2_eager_fallbackrE   rZ   make_strrF   rG   r   get_attrrW   r   )r   r   r8   rI   rJ   rK   rL   rM   rN   rO   ra   r`   s               rP   mutex_v2r     s    
			0h..0$#\\11i{I}g n I	;7)K!!+}=+'88YKdL!QXQK'""$3<<4mll=)+F::L<2('	.5 && -
##At,,## 
$;TtM M## 
s0    D E)EEE!E0 0FFzraw_ops.MutexV2c                    | d} t        j                  | d      } |d}t        j                  |d      }g }d| d|f}t        j                  dd||||      }t        j                         rt        j                  d|||       |\  }|S )Nr   r   r   s   MutexV2r   rV   r   )rZ   r   r   r   r   )r   r   r8   r9   r`   ra   rK   s          rP   r   r     s    I	;7)K!!+}=+,M;?&Z<v!$41'""$<2('	.rc   ) TV_ReadVariableOp_dtyper   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   r1   r2   rU   c                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| d|      }|S t        j                  |d      }t        j                   d| ||      \  }}}}	|	dd }t        j"                         r7d|j%                  d      f}
|j&                  }t        j(                  d||
|       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||      S # t        j                  $ r Y w xY w)aS  Reads the value of a variable.

  The tensor returned by this operation is immutable.

  The value returned by this operation is guaranteed to be influenced by all the
  writes on which this operation depends directly or indirectly, and to not be
  influenced by any of the writes which depend directly or indirectly on this
  operation.

  Args:
    resource: A `Tensor` of type `resource`.
      handle to the resource in which to store the variable.
    dtype: A `tf.DType`. the dtype of the value.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `dtype`.
  ReadVariableOprU   NrU   r8   r9   )r3   rU   r8   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   read_variable_op_eager_fallbackrE   rZ   	make_typerF   rG   r   _get_attr_typerW   r   )r3   rU   r8   rI   rJ   rK   rL   rM   rN   rO   ra   r`   s               rP   read_variable_opr     sT   & 
			0h..0$#\\11h@gn 

UG
,%'8885tE!QXQK'""$s))'23F::L,9('	.) && -
##At,,## 
,
%d6 6## 
s0    C& &D-9DD-,D-1E   EEzraw_ops.ReadVariableOpc                    t        j                  |d      }t        j                  | t        j
                        } | g}d|f}t        j                  dd||||      }t        j                         rt        j                  d|||       |\  }|S )NrU   s   ReadVariableOpr   rV   r   )	rZ   r   rA   r\   r]   r3   r   r   r   )r3   rU   r8   r9   r`   ra   rK   s          rP   r   r   2  s    


UG
,%##Hg.>.>?(,U&.,#)s?'""$,9('	.rc   ) TV_ResourceGather_dtyper   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   r1   r2   TV_ResourceGather_Tindicesr"   r$   indices
batch_dimsvalidate_indicesc                    t         j                   xs t        j                         }|j                  }|j                  r"	 t	        j
                  |d|| |d|d|d|      }|S t        j                  |d      }|d}t        j                  |d      }|d}t        j                   |d      }t#        j$                  d| |||||	      \  }
}
}}|dd }t        j&                         rjd|j)                  d      d|j+                  d      d|j-                  d      d
|j-                  d
      f}|j.                  }t        j0                  d|||       |\  }|S # t        j                  $ r }	t        j                  |	|       Y d}	~	nd}	~	wt        j                  $ r Y nw xY w	 t        | ||||||      S # t        j                  $ r Y gw xY w)at  Gather slices from the variable pointed to by `resource` according to `indices`.

  `indices` must be an integer tensor of any dimension (usually 0-D or 1-D).
  Produces an output tensor with shape `indices.shape + params.shape[1:]` where:

  ```python
      # Scalar indices
      output[:, ..., :] = params[indices, :, ... :]

      # Vector indices
      output[i, :, ..., :] = params[indices[i], :, ... :]

      # Higher rank indices
      output[i, ..., j, :, ... :] = params[indices[i, ..., j], :, ..., :]
  ```

  Args:
    resource: A `Tensor` of type `resource`.
    indices: A `Tensor`. Must be one of the following types: `int32`, `int64`.
    dtype: A `tf.DType`.
    batch_dims: An optional `int`. Defaults to `0`.
    validate_indices: An optional `bool`. Defaults to `True`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `dtype`.
  ResourceGatherr   r   rU   N)r   r   rU   r8   r9   r   T)r3   r   rU   r   r   r8   Tindices)r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   resource_gather_eager_fallbackrE   rZ   r   make_intro   rF   rG   r   _get_attr_int_get_attr_boolr   rW   r   )r3   r   rU   r   r   r8   rI   rJ   rK   rL   rM   rN   rO   ra   r`   s                  rP   resource_gatherr   C  s   8 
			0h..0$#\\11h&(8'5Jg n 

UG
,%J  \:*''(8:LM'888WE%/+;$H!QX QK'""$C--l; #"4"45G"Hs))'2J  ,.F ::L,9('	.A && -
##At,,## 
+
G
+5tO O ## 
s0     E F(FFF F2 2G	G	zraw_ops.ResourceGatherc                 
   t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j                  |g|t
        j                  t
        j                  g      \  }\  }t        j                  | t
        j                        } | |g}d|d|d|d|f}	t        j                  dd||	||	      }
t        j                         rt        j                  d
||	|
       |
\  }
|
S )NrU   r   r   Tr   r   s   ResourceGatherr   rV   r   )rZ   r   r   ro   r[   r]   int32int64rA   r\   r3   r   r   r   )r3   r   rU   r   r   r8   r9   _attr_Tindicesr`   ra   rK   s              rP   r   r     s   


UG
,%J  \:*''(8:LM'>>y#PWP]P]_f_l_lOop.*7##Hg.>.>?(G$,*&8:J	5*n.&.,#)s?'""$,9('	.rc   ) TV_ResourceGatherNd_dtyper   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   r1   r2   TV_ResourceGatherNd_Tindicesc           	         t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| |d|      }|S t        j                  |d      }t        j                   d| |||      \  }}}	}
|
dd }t        j"                         rHd|	j%                  d      d|	j%                  d      f}|	j&                  }t        j(                  d|||       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y w xY w)a
  TODO: add doc.

  Args:
    resource: A `Tensor` of type `resource`.
    indices: A `Tensor`. Must be one of the following types: `int32`, `int64`.
    dtype: A `tf.DType`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `dtype`.
  ResourceGatherNdrU   Nr   )r3   r   rU   r8   r   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   !resource_gather_nd_eager_fallbackrE   rZ   r   rF   rG   r   r   rW   r   )r3   r   rU   r8   rI   rJ   rK   rL   rM   rN   rO   ra   r`   s                rP   resource_gather_ndr     sn    
			0h..0$#\\11 $'7EKgn 

UG
,%'88Xwe!%'!QX QK'""$s))'2J  ,.F::LL&';('	.- && -
##At,,## 
.
G5t? ?## 
s0    C9 9E D''E ?E E E+*E+zraw_ops.ResourceGatherNdc                    t        j                  |d      }t        j                  |g|t        j                  t        j
                  g      \  }\  }t        j                  | t        j                        } | |g}d|d|f}t        j                  dd||||      }t        j                         rt        j                  d|||       |\  }|S )NrU   r   s   ResourceGatherNdr   rV   r   )rZ   r   r[   r]   r   r   rA   r\   r3   r   r   r   )	r3   r   rU   r8   r9   r   r`   ra   rK   s	            rP   r   r     s    


UG
,%'>>y#PWP]P]_f_l_lOop.*7##Hg.>.>?(G$,UJ7&0!L#)s?'""$L&';('	.rc   TV_ResourceScatterAdd_dtyper   r   r   r   r   r    r!   r%   r&   r'   r(   r)   r*   r-   r.   r0   r1   TV_ResourceScatterAdd_Tindicesupdatesc                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| ||      }|S t        j                  d| |||      \  }}}	}
|	S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y w xY w)aB  Adds sparse updates to the variable referenced by `resource`.

  This operation computes

      # Scalar indices
      ref[indices, ...] += updates[...]

      # Vector indices (for each i)
      ref[indices[i], ...] += updates[i, ...]

      # High rank indices (for each i, ..., j)
      ref[indices[i, ..., j], ...] += updates[i, ..., j, ...]

  Duplicate entries are handled correctly: if multiple `indices` reference
  the same location, their contributions add.

  Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`.

  <div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;">
  <img style="width:100%" src='https://www.tensorflow.org/images/ScatterAdd.png' alt>
  </div>

  Args:
    resource: A `Tensor` of type `resource`. Should be from a `Variable` node.
    indices: A `Tensor`. Must be one of the following types: `int32`, `int64`.
      A tensor of indices into the first dimension of `ref`.
    updates: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `complex64`, `int64`, `qint8`, `quint8`, `qint32`, `bfloat16`, `qint16`, `quint16`, `uint16`, `complex128`, `half`, `uint32`, `uint64`.
      A tensor of updated values to add to `ref`.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  ResourceScatterAddNr7   r3   r   r   r8   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   #resource_scatter_add_eager_fallbackrE   rF   rG   r3   r   r   r8   rI   rJ   rK   rL   rM   rN   rO   s              rP   resource_scatter_addr         D 
			0h..0$#\\11"D(GWFgn (88x&-D:!QX 
* && -
##At,,## 
0
GW4T; ;## 
0    A= =CB++CCC C.-C.zraw_ops.ResourceScatterAddc                    t        j                  |g|t        j                  t        j                  t        j
                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                   t        j"                  t        j$                  t        j&                  t        j(                  t        j*                  g      \  }\  }t        j                  |g|t        j
                  t        j                  g      \  }\  }t-        j.                  | t        j0                        } | ||g}d|d|f}t        j2                  dd||||      }	d }	|	S )NrU   r   s   ResourceScatterAddr   rV   rZ   r[   r]   float32float64r   uint8int16int8	complex64r   qint8quint8qint32bfloat16qint16quint16uint16
complex128halfuint32uint64rA   r\   r3   r   
r3   r   r   r8   r9   r_   r   r`   ra   rK   s
             rP   r   r        $;;WIsW__^e^m^movo|o|  F  L  L  NU  N[  N[  ]d  ]i  ]i  kr  k|  k|  ~E  ~K  ~K  MT  MZ  MZ  \c  \j  \j  ls  lz  lz  |C  |L  |L  NU  N\  N\  ^e  ^m  ^m  ov  o}  o}  F  Q  Q  SZ  S_  S_  ah  ao  ao  qx  q  q  MB  C+z'>>y#PWP]P]_f_l_lOop.*7##Hg.>.>?(GW-,[*n=&2Al#)s?''	.rc   TV_ResourceScatterDiv_dtypeTV_ResourceScatterDiv_Tindicesc                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| ||      }|S t        j                  d| |||      \  }}}	}
|	S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y w xY w)aL  Divides sparse updates into the variable referenced by `resource`.

  This operation computes

      # Scalar indices
      ref[indices, ...] /= updates[...]

      # Vector indices (for each i)
      ref[indices[i], ...] /= updates[i, ...]

      # High rank indices (for each i, ..., j)
      ref[indices[i, ..., j], ...] /= updates[i, ..., j, ...]

  Duplicate entries are handled correctly: if multiple `indices` reference
  the same location, their contributions multiply.

  Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`.

  <div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;">
  <img style="width:100%" src='https://www.tensorflow.org/images/ScatterAdd.png' alt>
  </div>

  Args:
    resource: A `Tensor` of type `resource`. Should be from a `Variable` node.
    indices: A `Tensor`. Must be one of the following types: `int32`, `int64`.
      A tensor of indices into the first dimension of `ref`.
    updates: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `complex64`, `int64`, `qint8`, `quint8`, `qint32`, `bfloat16`, `qint16`, `quint16`, `uint16`, `complex128`, `half`, `uint32`, `uint64`.
      A tensor of updated values to add to `ref`.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  ResourceScatterDivNr7   r   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   #resource_scatter_div_eager_fallbackrE   rF   rG   r   s              rP   resource_scatter_divr   .  r   r   zraw_ops.ResourceScatterDivc                    t        j                  |g|t        j                  t        j                  t        j
                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                   t        j"                  t        j$                  t        j&                  t        j(                  t        j*                  g      \  }\  }t        j                  |g|t        j
                  t        j                  g      \  }\  }t-        j.                  | t        j0                        } | ||g}d|d|f}t        j2                  dd||||      }	d }	|	S )NrU   r   s   ResourceScatterDivr   rV   r   r   s
             rP   r   r   h  r   rc   TV_ResourceScatterMax_dtypeTV_ResourceScatterMax_Tindicesc                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| ||      }|S t        j                  d| |||      \  }}}	}
|	S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y w xY w)a  Reduces sparse updates into the variable referenced by `resource` using the `max` operation.

  This operation computes

      # Scalar indices
      ref[indices, ...] = max(ref[indices, ...], updates[...])

      # Vector indices (for each i)
      ref[indices[i], ...] = max(ref[indices[i], ...], updates[i, ...])

      # High rank indices (for each i, ..., j)
      ref[indices[i, ..., j], ...] = max(ref[indices[i, ..., j], ...], updates[i, ..., j, ...])

  Duplicate entries are handled correctly: if multiple `indices` reference
  the same location, their contributions are combined.

  Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`.

  <div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;">
  <img style="width:100%" src='https://www.tensorflow.org/images/ScatterAdd.png' alt>
  </div>

  Args:
    resource: A `Tensor` of type `resource`. Should be from a `Variable` node.
    indices: A `Tensor`. Must be one of the following types: `int32`, `int64`.
      A tensor of indices into the first dimension of `ref`.
    updates: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `complex64`, `int64`, `qint8`, `quint8`, `qint32`, `bfloat16`, `qint16`, `quint16`, `uint16`, `complex128`, `half`, `uint32`, `uint64`.
      A tensor of updated values to add to `ref`.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  ResourceScatterMaxNr7   r   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   #resource_scatter_max_eager_fallbackrE   rF   rG   r   s              rP   resource_scatter_maxr   w  r   r   zraw_ops.ResourceScatterMaxc                    t        j                  |g|t        j                  t        j                  t        j
                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                   t        j"                  t        j$                  t        j&                  t        j(                  t        j*                  g      \  }\  }t        j                  |g|t        j
                  t        j                  g      \  }\  }t-        j.                  | t        j0                        } | ||g}d|d|f}t        j2                  dd||||      }	d }	|	S )NrU   r   s   ResourceScatterMaxr   rV   r   r   s
             rP   r   r     r   rc   TV_ResourceScatterMin_dtypeTV_ResourceScatterMin_Tindicesc                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| ||      }|S t        j                  d| |||      \  }}}	}
|	S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y w xY w)a  Reduces sparse updates into the variable referenced by `resource` using the `min` operation.

  This operation computes

      # Scalar indices
      ref[indices, ...] = min(ref[indices, ...], updates[...])

      # Vector indices (for each i)
      ref[indices[i], ...] = min(ref[indices[i], ...], updates[i, ...])

      # High rank indices (for each i, ..., j)
      ref[indices[i, ..., j], ...] = min(ref[indices[i, ..., j], ...], updates[i, ..., j, ...])

  Duplicate entries are handled correctly: if multiple `indices` reference
  the same location, their contributions are combined.

  Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`.

  <div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;">
  <img style="width:100%" src='https://www.tensorflow.org/images/ScatterAdd.png' alt>
  </div>

  Args:
    resource: A `Tensor` of type `resource`. Should be from a `Variable` node.
    indices: A `Tensor`. Must be one of the following types: `int32`, `int64`.
      A tensor of indices into the first dimension of `ref`.
    updates: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `complex64`, `int64`, `qint8`, `quint8`, `qint32`, `bfloat16`, `qint16`, `quint16`, `uint16`, `complex128`, `half`, `uint32`, `uint64`.
      A tensor of updated values to add to `ref`.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  ResourceScatterMinNr7   r   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   #resource_scatter_min_eager_fallbackrE   rF   rG   r   s              rP   resource_scatter_minr     r   r   zraw_ops.ResourceScatterMinc                    t        j                  |g|t        j                  t        j                  t        j
                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                   t        j"                  t        j$                  t        j&                  t        j(                  t        j*                  g      \  }\  }t        j                  |g|t        j
                  t        j                  g      \  }\  }t-        j.                  | t        j0                        } | ||g}d|d|f}t        j2                  dd||||      }	d }	|	S )NrU   r   s   ResourceScatterMinr   rV   r   r   s
             rP   r   r     r   rc   TV_ResourceScatterMul_dtypeTV_ResourceScatterMul_Tindicesc                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| ||      }|S t        j                  d| |||      \  }}}	}
|	S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y w xY w)aO  Multiplies sparse updates into the variable referenced by `resource`.

  This operation computes

      # Scalar indices
      ref[indices, ...] *= updates[...]

      # Vector indices (for each i)
      ref[indices[i], ...] *= updates[i, ...]

      # High rank indices (for each i, ..., j)
      ref[indices[i, ..., j], ...] *= updates[i, ..., j, ...]

  Duplicate entries are handled correctly: if multiple `indices` reference
  the same location, their contributions multiply.

  Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`.

  <div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;">
  <img style="width:100%" src='https://www.tensorflow.org/images/ScatterAdd.png' alt>
  </div>

  Args:
    resource: A `Tensor` of type `resource`. Should be from a `Variable` node.
    indices: A `Tensor`. Must be one of the following types: `int32`, `int64`.
      A tensor of indices into the first dimension of `ref`.
    updates: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `complex64`, `int64`, `qint8`, `quint8`, `qint32`, `bfloat16`, `qint16`, `quint16`, `uint16`, `complex128`, `half`, `uint32`, `uint64`.
      A tensor of updated values to add to `ref`.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  ResourceScatterMulNr7   r   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   #resource_scatter_mul_eager_fallbackrE   rF   rG   r   s              rP   resource_scatter_mulr   	  r   r   zraw_ops.ResourceScatterMulc                    t        j                  |g|t        j                  t        j                  t        j
                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                   t        j"                  t        j$                  t        j&                  t        j(                  t        j*                  g      \  }\  }t        j                  |g|t        j
                  t        j                  g      \  }\  }t-        j.                  | t        j0                        } | ||g}d|d|f}t        j2                  dd||||      }	d }	|	S )NrU   r   s   ResourceScatterMulr   rV   r   r   s
             rP   r   r   C  r   rc   TV_ResourceScatterSub_dtypeTV_ResourceScatterSub_Tindicesc                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| ||      }|S t        j                  d| |||      \  }}}	}
|	S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y w xY w)aI  Subtracts sparse updates from the variable referenced by `resource`.

  This operation computes

      # Scalar indices
      ref[indices, ...] -= updates[...]

      # Vector indices (for each i)
      ref[indices[i], ...] -= updates[i, ...]

      # High rank indices (for each i, ..., j)
      ref[indices[i, ..., j], ...] -= updates[i, ..., j, ...]

  Duplicate entries are handled correctly: if multiple `indices` reference
  the same location, their contributions add.

  Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`.

  <div style="width:70%; margin:auto; margin-bottom:10px; margin-top:20px;">
  <img style="width:100%" src='https://www.tensorflow.org/images/ScatterAdd.png' alt>
  </div>

  Args:
    resource: A `Tensor` of type `resource`. Should be from a `Variable` node.
    indices: A `Tensor`. Must be one of the following types: `int32`, `int64`.
      A tensor of indices into the first dimension of `ref`.
    updates: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `complex64`, `int64`, `qint8`, `quint8`, `qint32`, `bfloat16`, `qint16`, `quint16`, `uint16`, `complex128`, `half`, `uint32`, `uint64`.
      A tensor of updated values to add to `ref`.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  ResourceScatterSubNr7   r   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   #resource_scatter_sub_eager_fallbackrE   rF   rG   r   s              rP   resource_scatter_subr   R  r   r   zraw_ops.ResourceScatterSubc                    t        j                  |g|t        j                  t        j                  t        j
                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                   t        j"                  t        j$                  t        j&                  t        j(                  t        j*                  g      \  }\  }t        j                  |g|t        j
                  t        j                  g      \  }\  }t-        j.                  | t        j0                        } | ||g}d|d|f}t        j2                  dd||||      }	d }	|	S )NrU   r   s   ResourceScatterSubr   rV   r   r   s
             rP   r   r     r   rc   ) TV_ResourceScatterUpdate_dtyper   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   r1   r2   !TV_ResourceScatterUpdate_Tindicesc                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| ||      }|S t        j                  d| |||      \  }}}	}
|	S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y w xY w)a  Assigns sparse updates to the variable referenced by `resource`.

  This operation computes

      # Scalar indices
      ref[indices, ...] = updates[...]

      # Vector indices (for each i)
      ref[indices[i], ...] = updates[i, ...]

      # High rank indices (for each i, ..., j)
      ref[indices[i, ..., j], ...] = updates[i, ..., j, ...]

  Args:
    resource: A `Tensor` of type `resource`. Should be from a `Variable` node.
    indices: A `Tensor`. Must be one of the following types: `int32`, `int64`.
      A tensor of indices into the first dimension of `ref`.
    updates: A `Tensor`. A tensor of updated values to add to `ref`.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  ResourceScatterUpdateNr7   r   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   &resource_scatter_update_eager_fallbackrE   rF   rG   r   s              rP   resource_scatter_updater    s    0 
			0h..0$#\\11%tXwIgn (88(G)0t=!QX 
* && -
##At,,## 
3
GW4T; ;## 
r   zraw_ops.ResourceScatterUpdatec                 N   t        j                  |g|g       \  }\  }t        j                  |g|t        j                  t        j                  g      \  }\  }t        j                  | t        j                        } | ||g}d|d|f}t        j                  dd||||      }	d }	|	S )NrU   r   s   ResourceScatterUpdater   rV   )	rZ   r[   r]   r   r   rA   r\   r3   r   r   s
             rP   r  r    s    $;;WIsBO+z'>>y#PWP]P]_f_l_lOop.*7##Hg.>.>?(GW-,[*n=&5q#)s?''	.rc   ) TV_VarHandleOp_dtyper   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   r1   r2   
debug_namec                    t         j                   xs t        j                         }|j                  }|j                  r&	 t	        j
                  |d|d|d|d|d| d|d|      }	|	S t        j                  | d      } t        j                  |d      }|d
}t        j                   |d      }|d
}t        j                   |d      }|d
}t        j                   |d      }|g }t#        |t$        t&        f      st)        d|z        |D cg c]  }t        j                   |d       }}t+        j,                  d| ||||||      \  }}}}|dd }	t        j.                         rd|j1                  d      d|j1                  d      d|j1                  d      d|j3                  d      d|j1                  d      d|j1                  d      f}|j4                  }t        j6                  d|||	       |	\  }	|	S # t        j                  $ r }
t        j                  |
|       Y d}
~
nd}
~
wt        j                  $ r Y nw xY w	 t        |||| ||||	      S # t        j                  $ r Y w xY wc c}w )a  Creates a handle to a Variable resource.

  Args:
    dtype: A `tf.DType`. the type of this variable. Must agree with the dtypes
      of all ops using this variable.
    shape: A `tf.TensorShape` or list of `ints`.
      The (possibly partially specified) shape of this variable.
    container: An optional `string`. Defaults to `""`.
      the container this variable is placed in.
    shared_name: An optional `string`. Defaults to `""`.
      the name by which this variable is referred to.
    debug_name: An optional `string`. Defaults to `""`.
      the user-given name, which still applies in anonymous mode.
    allowed_devices: An optional list of `strings`. Defaults to `[]`.
      DEPRECATED. The allowed devices containing the resource variable. Set when the
      output ResourceHandle represents a per-replica/partitioned resource variable.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  VarHandleOpr   r   r	  rU   shapeallowed_devicesN)r   r   r	  rU   r  r  r8   r9   r   KExpected list for 'allowed_devices' argument to 'var_handle_op' Op, not %r.)rU   r  r   r   r	  r  r8   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   var_handle_op_eager_fallbackrE   rZ   r   
make_shaper   
isinstancelisttuple	TypeErrorrF   rG   r   r   r   rW   r   )rU   r  r   r   r	  r  r8   rI   rJ   rK   rL   _srM   rN   rO   ra   r`   s                    rP   var_handle_opr    s   , 
			0h..0$#\\	11mT;	=\:ww?,g n 

UG
,%


eW
-%I	;7)K!!+}=+J  \:*O	OdE]	3
	&(7	89 9 IXX"X&&r+<=X/X'88U%9#.:'6TC!QX QK'""$3<<4mll=)<ll<('  )7CLL4I.?!@	BF
 ::L|VW6('	.[ && -
##At,,## 
);:UO  ## 
( Ys6    $G7 I/7H>
H%%H>=H>I I,+I,zraw_ops.VarHandleOpc                 P   t        j                  | d      } t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }|g }t	        |t
        t        f      st        d|z        |D cg c]  }t        j                  |d       }}g }	d|d|d|d| d|d|f}
t        j                  d	d
|	|
||      }t        j                         rt        j                  d|	|
|       |\  }|S c c}w )NrU   r  r   r   r   r	  r  r  s   VarHandleOpr   rV   r  )rZ   r   r  r   r  r  r  r  r   r   r   )rU   r  r   r   r	  r  r8   r9   r  r`   ra   rK   s               rP   r  r  *  sQ   


UG
,%


eW
-%I	;7)K!!+}=+J  \:*O	OdE]	3
	&(7	89 9 IXX"X&&r+<=X/X,M;gugu.?& ^Q|#)s?'""$|VW6('	. Ys   'D#c                 \   t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d||       }|S t        j                  d| |      \  }}}}|dd }t        j                          r&d}	|j"                  }
t        j$                  d|
|	|       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||      S # t        j                  $ r Y w xY w)zChecks whether a resource handle-based variable has been initialized.

  Args:
    resource: A `Tensor` of type `resource`. the input resource handle.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `bool`.
  VarIsInitializedOpNr7   r   r   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   $var_is_initialized_op_eager_fallbackrE   rF   rG   rZ   r   rW   r   )r3   r8   rI   rJ   rK   rL   rM   rN   rO   ra   r`   s              rP   var_is_initialized_opr  J  s(    
			0h..0$#\\11"D(4gn (88xd<!QXQK'""$F::LlFG=('	.' && -
##At,,## 
1
4) )## 
r   zraw_ops.VarIsInitializedOpc                     t        j                  | t        j                        } | g}d }t	        j
                  dd||||      }t	        j                         rt	        j                  d|||       |\  }|S )Ns   VarIsInitializedOpr   rV   r  r   r   s         rP   r  r  s  ss    ##Hg.>.>?(,&2Al#)s?'""$lFG=('	.rc   TV_VariableShape_out_typeinputout_typec                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| d|      }|S |t        j                  }t        j                   |d      }t#        j$                  d| ||      \  }}}}	|	dd }t        j&                         r7d|j)                  d      f}
|j*                  }t        j,                  d||
|       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||      S # t        j                  $ r Y w xY w)a  Returns the shape of the variable pointed to by `resource`.

  This operation returns a 1-D integer tensor representing the shape of `input`.

  For example:

  ```
  # 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]
  shape(t) ==> [2, 2, 3]
  ```

  Args:
    input: A `Tensor` of type `resource`.
    out_type: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int32`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `out_type`.
  VariableShaper  N)r  r8   r9   )r  r  r8   )r;   r   r<   r=   r   r>   r?   r@   rA   rB   rC   variable_shape_eager_fallbackrE   r]   r   rZ   r   rF   rG   r   r   rW   r   )r  r  r8   rI   rJ   rK   rL   rM   rN   rO   ra   r`   s               rP   variable_shaper#    sb   ( 
			0h..0$#\\11otUJBgn }}H*5('88uxdD!QXQK'""$#,,Z89F::Lvw8('	.- && -
##At,,## 
*
(49 9## 
s0    C8 8D?D&&D?>D?E E)(E)zraw_ops.VariableShapec                 B   |t         j                  }t        j                  |d      }t	        j
                  | t         j                        } | g}d|f}t        j                  dd||||      }t        j                         rt        j                  d|||       |\  }|S )Nr  s   VariableShaper   rV   r!  )
r]   r   rZ   r   rA   r\   r3   r   r   r   )r  r  r8   r9   r`   ra   rK   s          rP   r"  r"    s    }}H*5(

 
 (8(8
9%,!&-q#)s?'""$vw8('	.rc   )N)FN)TN)r   r   N)r   TN)__doc__collectionstensorflow.pythonr   tensorflow.python.eagerr   r;   r   r?   r   rZ   tensorflow.python.frameworkr   r]   tensorflow.security.fuzzing.pyr   _atypesr	   _op_def_registryr
   rA   r   rF   "tensorflow.python.util.deprecationr   tensorflow.python.utilr   	_dispatch tensorflow.python.util.tf_exportr   typingr   r   r   typing_extensionsr   r   ResourcerQ   	to_raw_opr6   rD   rd   rh   rf   rg   rj   boolrp   rm   rn   Variantrv   rt   ru   r~   r|   r}   r   r   r   rr   r   r   strr   r   r   r   r   r   r   r   r   intr   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   r   r   r  r  r  r  r  r  r  r  r  Boolr  r  r  r  r   r#  r!  r"  r   rc   rP   <module>r:     s  
  6 7 1 7 9 F K 3 I C 8 6 % % '&   \
 "YsG4D4D/D%E "iX[]yXyNz "F ?i =>~t~~Nd?ef Ic7CSCS>S4T ]fgj  mI  hI  ^J   '   \
 "YsG4D4D/D%E "iX[]yXyNz "F ?i =>~t~~Nd?ef Ic7CSCS>S4T ]fgj  mI  hI  ^J  $  V
 (30@0@+@!A ()TWYrTrJs (  EI (R 9978HZ9[\ 	#w?O?O:O0P Ybcf  iB  dB  ZC   UY &9S'//-A#B &N 9978HZ9[\ )C<P2Q *)C1A1A,A"B *X\ *V ;I9:>4>>J];^_ 
3@P@P;P1Q 
hl 
 9S'2B2B-B#C  B ;I9:>4>>J^;_` )CAQAQ<Q2R KiW%5%5 56 KiPSU\UdUdPdFe KZ +I)*>4>>*+EF	
YsG4D4D/D%E 
U^_bdkdsds_sUt 
1s 13 13PWP`P`K`Aa 1f ')%
&~t~~h'?
@s  IVY[b[k[kVkLl $ "  R
 .yg.>.>)>? .H_ .oxy|  V  zV  pW .` 534^T^^DT5UViW=M=M8M.N Wn   H  IL  Ne  Ie  f  "  R
 $%A?Tcd DiW-=-=(=> DSVXrSrIs D  }T D  ad D  y} D  R[  \_  ax  \x  Ry DL 534^T^^O5TUYsG<L<L7L-M Xabe  hB  cB  YC   Lc   qt   HL   \e  fi  kB  fB  \C , $  V
 &'EXgh )30@0@+@!A )IVY[wVwLx )  B[ )  kt  ux  zS  uS  kT )V 9978HZ9[\ 	#w?O?O:O0P [deh  kG  fG  \H   Qj   zC  DG  Ib  Db  zc  &&CEWYm  pC  EV  Xi  ky  {J  L[  ]l  n|  ~N  P`  bq  sD  FV  Xh  jz  |L  N]  ^ !()I?\k!l 69S'2B2B-B#C 6iX[]{X{N| 6  HQ  RU  Wr  Rr  Hs 6n =Y;<^T^^L`=ab 	)CAQAQ<Q2R 	]fgj  mK  hK  ^L 	  W`  ad  fA  aA  WB 	 &&CEWYm  pC  EV  Xi  ky  {J  L[  ]l  n|  ~N  P`  bq  sD  FV  Xh  jz  |L  N]  ^ !()I?\k!l 69S'2B2B-B#C 6iX[]{X{N| 6  HQ  RU  Wr  Rr  Hs 6n =Y;<^T^^L`=ab 	)CAQAQ<Q2R 	]fgj  mK  hK  ^L 	  W`  ad  fA  aA  WB 	 &&CEWYm  pC  EV  Xi  ky  {J  L[  ]l  n|  ~N  P`  bq  sD  FV  Xh  jz  |L  N]  ^ !()I?\k!l 69S'2B2B-B#C 6iX[]{X{N| 6  HQ  RU  Wr  Rr  Hs 6n =Y;<^T^^L`=ab 	)CAQAQ<Q2R 	]fgj  mK  hK  ^L 	  W`  ad  fA  aA  WB 	 &&CEWYm  pC  EV  Xi  ky  {J  L[  ]l  n|  ~N  P`  bq  sD  FV  Xh  jz  |L  N]  ^ !()I?\k!l 69S'2B2B-B#C 6iX[]{X{N| 6  HQ  RU  Wr  Rr  Hs 6n =Y;<^T^^L`=ab 	)CAQAQ<Q2R 	]fgj  mK  hK  ^L 	  W`  ad  fA  aA  WB 	 &&CEWYm  pC  EV  Xi  ky  {J  L[  ]l  n|  ~N  P`  bq  sD  FV  Xh  jz  |L  N]  ^ !()I?\k!l 69S'2B2B-B#C 6iX[]{X{N| 6  HQ  RU  Wr  Rr  Hs 6n =Y;<^T^^L`=ab 	)CAQAQ<Q2R 	]fgj  mK  hK  ^L 	  W`  ad  fA  aA  WB 	 &&CEWYm  pC  EV  Xi  ky  {J  L[  ]l  n|  ~N  P`  bq  sD  FV  Xh  jz  |L  N]  ^ !()I?\k!l 69S'2B2B-B#C 6iX[]{X{N| 6  HQ  RU  Wr  Rr  Hs 6n =Y;<^T^^L`=ab 	)CAQAQ<Q2R 	]fgj  mK  hK  ^L 	  W`  ad  fA  aA  WB 	 ")  "`
 $+,OQ`bq$r !,iW5E5E0E&F ,QZ[^  aB  \B  RC ,  NW  X[  ]{  X{  N| ,Z C	"AB>4>>RiCjk 	YsGDTDT?T5U 	`ijm  pQ  kQ  aR 	  ]f  gj  lJ  gJ  ]K 	   L
 DFXZkm  @B  IM L- L LTW Lgj L  R[  \_  ah  aq  aq  \q  Rr L\ /i-.~t~~m/LM(< PS be sv   Xa  be  gn  gw  gw  bw  Xx @$Ic73C3C.C$D $T]^acjcoco^oTp $L =Y;<^T^^La=bc 
9S'BRBR=R3S 
clmpryr~r~m~c 
 $$?Rab _f_l_lsw 1)C)9)9$9: 1E^ 1  }F  GJ  Le  Ge  }f 1f 3	12>4>>.3QR38H8H3H)I Un   H  IL  Ng  Ig  h rc   