
    ij0                     z    d dl mZ d dlmZ d dlmZ  ed       G d d             ZddZ ed	d
g      d        Zy)    )tree)keras_export)	auto_namezkeras.KerasTensorc                   x   e Zd ZdZ	 	 	 	 	 d=dZed        Zej                  d        Zed        Zej                  d        Zed        Z	e	j                  d	        Z	ed
        Z
e
j                  d        Z
ed        Zej                  d        Zed        Zej                  d        Zed        Zd Zd>dZd Zd Zd Zd Z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d# Z d$ Z!d% Z"d& Z#d' Z$d( Z%d) Z&d* Z'd+ Z(d, Z)d- Z*d. Z+d/ Z,d0 Z-d1 Z.d2 Z/d3 Z0d4 Z1d5 Z2d6 Z3d7 Z4d8 Z5d9 Z6d: Z7d; Z8d>d<Z9y)@KerasTensora  Symbolic tensor -- encapsulates a shape and a dtype.

    You can use `KerasTensor` instances to build computation
    graphs of Keras operations, such as `keras.Function`
    objects or Functional `keras.models.Model` objects.

    Example:

    >>> x = keras.KerasTensor(shape=(3, 4), dtype="float32")
    >>> x.shape
    (3, 4)
    >>> x.dtype
    float32

    Calling a Keras operation (including a layer or a model)
    on a `KerasTensor` instance will return another `KerasTensor`
    instance with the appropriate shape and dtype. This is
    called a "symbolic call" (since there is no actual data
    involved). The computation of the correct output shape and
    dtype is called "static shape inference".
    Nc                 J   ddl m} |j                  dd       }	|j                  dd       }
|r+t        ddj	                  |j                                      |j                  |      | _        |j                  |      | _	        t        |      | _        t        |      | _        | j                  r| j                  rt        d      |	t        |	      nd | _        |
|j                  |
      nd | _        |xs t#        | j$                  j&                        | _        || _        y )Nr   )backendragged_rankrow_splits_dtypezUnexpected keyword arguments: z, zIKerasTensor cannot have `sparse=True` and `ragged=True` at the same time.)	keras.srcr	   pop	TypeErrorjoinkeysstandardize_shape_shapestandardize_dtype_dtypebool_sparse_ragged
ValueErrorint_ragged_rank_row_splits_dtyper   	__class____name__namerecord_history)selfshapedtypesparseraggedr   r   kwargsr	   r
   r   s              z/var/www/html/emotional.easysim.app/public_html/venv/lib/python3.12/site-packages/keras/src/backend/common/keras_tensor.py__init__zKerasTensor.__init__   s    	&jj5!::&8$?06;;=1I0JK  //6//6F|F|<<DLL! 
 !, 7CT 	
  + %%&67 	
 >Idnn&=&=>	,    c                     | j                   S N)r   r    s    r&   r!   zKerasTensor.shapeE       {{r(   c                     t        d      )NzlThe `shape` attribute of KerasTensor is immutable. One should create a new instance of KerasTensor for this.AttributeErrorr    values     r&   r!   zKerasTensor.shapeI       =
 	
r(   c                     | j                   S r*   )r   r+   s    r&   r"   zKerasTensor.dtypeP   r,   r(   c                     t        d      )NzlThe `dtype` attribute of KerasTensor is immutable. One should create a new instance of KerasTensor for this.r.   r0   s     r&   r"   zKerasTensor.dtypeT   r2   r(   c                     | j                   S r*   )r   r+   s    r&   r#   zKerasTensor.sparse[       ||r(   c                     t        d      )NzmThe `sparse` attribute of KerasTensor is immutable. One should create a new instance of KerasTensor for this.r.   r0   s     r&   r#   zKerasTensor.sparse_   r2   r(   c                     | j                   S r*   )r   r+   s    r&   r
   zKerasTensor.ragged_rankf   s       r(   c                     t        d      )NzrThe `ragged_rank` attribute of KerasTensor is immutable. One should create a new instance of KerasTensor for this.r.   r0   s     r&   r
   zKerasTensor.ragged_rankj       D
 	
r(   c                     | j                   S r*   )r   r+   s    r&   r   zKerasTensor.row_splits_dtypeq   s    %%%r(   c                     t        d      )NzwThe `row_splits_dtype` attribute of KerasTensor is immutable. One should create a new instance of KerasTensor for this.r.   r0   s     r&   r   zKerasTensor.row_splits_dtypeu   r:   r(   c                     | j                   S r*   )r   r+   s    r&   r$   zKerasTensor.ragged|   r6   r(   c                     t        d      )NzmThe `ragged` attribute of KerasTensor is immutable. One should create a new instance of KerasTensor for this.r.   r0   s     r&   r$   zKerasTensor.ragged   r2   r(   c                 ,    t        | j                        S r*   )lenr!   r+   s    r&   ndimzKerasTensor.ndim   s    4::r(   c                 <    ddl m}  |j                  |      |       S Nr   ops)r   rE   Reshape)r    newshaperE   s      r&   reshapezKerasTensor.reshape   s    !$s{{8$T**r(   c                 <    ddl m}  |j                  |      |       S rC   )r   rE   Squeeze)r    axisrE   s      r&   squeezezKerasTensor.squeeze   s    ! s{{4 &&r(   c                     t        d      )NzA KerasTensor is symbolic: it's a placeholder for a shape an a dtype. It doesn't have any actual numerical value. You cannot convert it to an int.r   r+   s    r&   __int__zKerasTensor.__int__   s    /
 	
r(   c                     t        d      )NzA KerasTensor is symbolic: it's a placeholder for a shape an a dtype. It doesn't have any actual numerical value. You cannot convert it to a float.rN   r+   s    r&   	__float__zKerasTensor.__float__   s    0
 	
r(   c                     t        d      )NzA KerasTensor is symbolic: it's a placeholder for a shape an a dtype. It doesn't have any actual numerical value. You cannot convert it to a NumPy array.rN   r+   s    r&   	__array__zKerasTensor.__array__   s    6
 	
r(   c                     t        d      )Na%  A KerasTensor cannot be used as input to a JAX function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces `keras.layers` and `keras.ops`). You are likely doing something like:

```
x = Input(...)
...
jax_fn(x)  # Invalid.
```

What you should do instead is wrap `jax_fn` in a layer:

```
class MyLayer(Layer):
    def call(self, x):
        return jax_fn(x)

x = MyLayer()(x)
```
rN   r+   s    r&   __jax_array__zKerasTensor.__jax_array__       
 	
r(   c                     t        d      )Na)  A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces `keras.layers` and `keras.ops`). You are likely doing something like:

```
x = Input(...)
...
tf_fn(x)  # Invalid.
```

What you should do instead is wrap `tf_fn` in a layer:

```
class MyLayer(Layer):
    def call(self, x):
        return tf_fn(x)

x = MyLayer()(x)
```
rN   )r    r"   r   s      r&   __tf_tensor__zKerasTensor.__tf_tensor__   rV   r(   c                     d| j                    d| j                   d| j                   d| j                   d| j                   dS )Nz<KerasTensor shape=z, dtype=z	, sparse=z	, ragged=z, name=>)r!   r"   r#   r$   r   r+   s    r&   __repr__zKerasTensor.__repr__   sG    !$**Xdjj\ Bkk])DKK=		{!M	
r(   c                     t        d      )Nz7Iterating over a symbolic KerasTensor is not supported.)NotImplementedErrorr+   s    r&   __iter__zKerasTensor.__iter__   s    !E
 	
r(   c                     t        d      )Nz3A symbolic KerasTensor cannot be used as a boolean.)r   r+   s    r&   __bool__zKerasTensor.__bool__   s    MNNr(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   Addsymbolic_callr    otherrE   s      r&   __add__zKerasTensor.__add__       !wwy&&tU33r(   c                 N    ddl m} |j                         j                  ||       S rC   rb   re   s      r&   __radd__zKerasTensor.__radd__       !wwy&&ud33r(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   Subtractrd   re   s      r&   __sub__zKerasTensor.__sub__       !||~++D%88r(   c                 N    ddl m} |j                         j                  ||       S rC   rm   re   s      r&   __rsub__zKerasTensor.__rsub__       !||~++E488r(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   Multiplyrd   re   s      r&   __mul__zKerasTensor.__mul__   rp   r(   c                 N    ddl m} |j                         j                  ||       S rC   ru   re   s      r&   __rmul__zKerasTensor.__rmul__   rs   r(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   Matmulrd   re   s      r&   
__matmul__zKerasTensor.__matmul__      !zz|))$66r(   c                 N    ddl m} |j                         j                  ||       S rC   r{   re   s      r&   __rmatmul__zKerasTensor.__rmatmul__	      !zz|))%66r(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   Dividerd   re   s      r&   __div__zKerasTensor.__div__  r~   r(   c                 N    ddl m} |j                         j                  ||       S rC   r   re   s      r&   __rdiv__zKerasTensor.__rdiv__  r   r(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   
TrueDividerd   re   s      r&   __truediv__zKerasTensor.__truediv__      !~~--dE::r(   c                 N    ddl m} |j                         j                  ||       S rC   r   re   s      r&   __rtruediv__zKerasTensor.__rtruediv__      !~~--eT::r(   c                 L    ddl m} |j                         j                  |       S rC   )r   rE   Negativerd   r    rE   s     r&   __neg__zKerasTensor.__neg__"      !||~++D11r(   c                 L    ddl m} |j                         j                  |       S rC   )r   rE   Absoluterd   r   s     r&   __abs__zKerasTensor.__abs__'  r   r(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   Powerrd   re   s      r&   __pow__zKerasTensor.__pow__,  s    !yy{((u55r(   c                 N    ddl m} |j                         j                  ||       S rC   r   re   s      r&   __rpow__zKerasTensor.__rpow__1  s    !yy{((55r(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   FloorDividerd   re   s      r&   __floordiv__zKerasTensor.__floordiv__6  s    ! ..tU;;r(   c                 N    ddl m} |j                         j                  ||       S rC   r   re   s      r&   __rfloordiv__zKerasTensor.__rfloordiv__;  s    ! ..ud;;r(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   Modrd   re   s      r&   __mod__zKerasTensor.__mod__@  rh   r(   c                 N    ddl m} |j                         j                  ||       S rC   r   re   s      r&   __rmod__zKerasTensor.__rmod__E  rk   r(   c                 N    ddl m} |j                         j                  | |      S rC   )r   rE   Lessrd   re   s      r&   __lt__zKerasTensor.__lt__J  s    !xxz''e44r(   c                 N    ddl m} |j                         j                  | |      S rC   )r   rE   	LessEqualrd   re   s      r&   __le__zKerasTensor.__le__O      !}},,T599r(   c                 N    ddl m} |j                         j                  | |      S rC   )r   rE   Greaterrd   re   s      r&   __gt__zKerasTensor.__gt__T  s    !{{}**477r(   c                 N    ddl m} |j                         j                  | |      S rC   )r   rE   GreaterEqualrd   re   s      r&   __ge__zKerasTensor.__ge__Y  s!    !!//e<<r(   c                 N    ddl m} |j                         j                  | |      S rC   )r   rE   NotEqualrd   re   s      r&   __ne__zKerasTensor.__ne__^  rp   r(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   
LogicalAndrd   re   s      r&   __and__zKerasTensor.__and__c  r   r(   c                 N    ddl m} |j                         j                  ||       S rC   r   re   s      r&   __rand__zKerasTensor.__rand__h  r   r(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   	LogicalOrrd   re   s      r&   __or__zKerasTensor.__or__m  r   r(   c                 N    ddl m} |j                         j                  ||       S rC   r   re   s      r&   __ror__zKerasTensor.__ror__r  s    !}},,UD99r(   c                 L    ddl m} |j                         j                  |       S rC   )r   rE   
LogicalNotrd   r   s     r&   
__invert__zKerasTensor.__invert__w  s    !~~--d33r(   c                 N    ddl m} |j                         j                  | |      S rC   r   rE   
LogicalXorrd   re   s      r&   __xor__zKerasTensor.__xor__|  r   r(   c                 N    ddl m} |j                         j                  ||       S rC   r   re   s      r&   __rxor__zKerasTensor.__rxor__  r   r(   c                 N    ddl m} |j                         j                  | |      S rC   )r   rE   GetItemrd   )r    keyrE   s      r&   __getitem__zKerasTensor.__getitem__  s    !{{}**455r(   c                 \    ddl m} |xs d}|j                  |      j                  |       S )Nr   rD   )decimals)r   rE   Roundrd   )r    ndigitsrE   r   s       r&   	__round__zKerasTensor.__round__  s*    !<ayy(y+99$??r(   )float32FFTNr*   NN):r   
__module____qualname____doc__r'   propertyr!   setterr"   r#   r
   r   r$   rA   rH   rL   rO   rQ   rS   rU   rX   r[   r^   r`   rg   rj   ro   rr   rw   ry   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      s   2 %-N   \\
 
   \\
 
   ]]
 
 ! ! 
 
 & & 
 
   ]]
 
  +
'




.
.


O4
4
9
9
9
9
7
7
7
7
;
;
2
2
6
6
<
<
4
4
5
:
8
=
9
;
;
:
:
4
;
;
6
@r(   r   Nc                     | xs d|r|j                         ndfD ]`  }|D ]Y  }t        |t              r  yt        j                  |      s,t        j
                  |      D ]  }t        |t              s   y [ b y)Nr   TF)values
isinstancer   r   	is_nestedflatten)argsr%   itemsxnesteds        r&   any_symbolic_tensorsr     su    *"fmmoR@ $ 	$A![)~~a "ll1o $F!&+6#$		$$ r(   zkeras.utils.is_keras_tensorzkeras.backend.is_keras_tensorc                 "    t        | t              S )a|  Returns whether `x` is a Keras tensor.

    A "Keras tensor" is a *symbolic tensor*, such as a tensor
    that was created via `Input()`. A "symbolic tensor"
    can be understood as a placeholder -- it does not
    contain any actual numerical data, only a shape and dtype.
    It can be used for building Functional models, but it
    cannot be used in actual computations.
    )r   r   )r   s    r&   is_keras_tensorr     s     a%%r(   r   )	r   r   keras.src.api_exportr   keras.src.utils.namingr   r   r   r   r   r(   r&   <module>r      sZ     - , !"H@ H@ #H@V	 ,.MNO
& P
&r(   