
    ij	                     x    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  ed       G d d	e             Zy
)    )ops)keras_export)KerasTensor)Layer)operation_utils)validate_reshape_shapezkeras.layers.Reshapec                   >     e Zd ZdZ fdZd Zd Zd Z fdZ xZ	S )Reshapea  Layer that reshapes inputs into the given shape.

    Args:
        target_shape: Target shape. Tuple of integers, does not include the
            samples dimension (batch size). One element of the `target_shape`
            can be -1 in which case the missing value is inferred from the
            size of the array and remaining dimensions.

    Input shape:
        Arbitrary, but required to be compatible with `target_shape`.

    Output shape:
        `(batch_size, *target_shape)`

    Example:

    >>> x = keras.Input(shape=(12,))
    >>> y = keras.layers.Reshape((3, 4))(x)
    >>> y.shape
    (None, 3, 4)

    >>> # another example with shape inference using `-1` as dimension
    >>> y = keras.layers.Reshape((-1, 2, 2))(x)
    >>> y.shape
    (None, 3, 2, 2)
    c                 p    t        |   di | t        |      }t        |d       || _        d| _        y )Ntarget_shape)newshape_arg_nameT )super__init__tupler   r   built)selfr   kwargs	__class__s      w/var/www/html/emotional.easysim.app/public_html/venv/lib/python3.12/site-packages/keras/src/layers/reshaping/reshape.pyr   zReshape.__init__&   s6    "6"\*|~N(
    c                 X    |d   gt        j                  |dd  | j                  d      S )Nr      r   )r   compute_reshape_output_shaper   )r   input_shapes     r   compute_output_shapezReshape.compute_output_shape-   s9    N
99AB!2!2N
 	
r   c                 |    | j                  |j                        }t        ||j                  |j                        S )N)shapedtypesparse)r   r   r   r   r    )r   inputsoutput_shapes      r   compute_output_speczReshape.compute_output_spec5   s2    00>fll6==
 	
r   c                     t        j                  t        |j                        dd  | j                  d      }t        d |D              }t        j                  |t        j                  |      d   f|z         S )Nr   r   c              3   (   K   | ]
  }|dn|  y w)Nr   ).0ds     r   	<genexpr>zReshape.call.<locals>.<genexpr>A   s      2
'(!)B"2
s   r   )r   r   r   r   r   r   reshape)r   r!   !potentially_resolved_target_shapes      r   callzReshape.call;   s{    88fll#AB'):):N 	*
 -2 2
,M2
 -
) {{SYYv&q)+.OO
 	
r   c                 H    d| j                   i}t        | 	         }i ||S )Nr   )r   r   
get_config)r   configbase_configr   s      r   r.   zReshape.get_configH   s0     $"3"34g(*(+(((r   )
__name__
__module____qualname____doc__r   r   r#   r,   r.   __classcell__)r   s   @r   r
   r
   	   s&    6


) )r   r
   N)	keras.srcr   keras.src.api_exportr   %keras.src.backend.common.keras_tensorr   keras.src.layers.layerr   keras.src.opsr   keras.src.ops.operation_utilsr   r
   r   r   r   <module>r<      s;     - = ( ) @ $%A)e A) &A)r   