
    2Vh
                     `    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)	    )keras_export)	InputSpec)Layer)argument_validationzkeras.layers.Cropping1Dc                   :     e Zd ZdZd fd	Zd Zd Z fdZ xZS )
Cropping1Da  Cropping layer for 1D input (e.g. temporal sequence).

    It crops along the time dimension (axis 1).

    Example:

    >>> input_shape = (2, 3, 2)
    >>> x = np.arange(np.prod(input_shape)).reshape(input_shape)
    >>> x
    [[[ 0  1]
      [ 2  3]
      [ 4  5]]
     [[ 6  7]
      [ 8  9]
      [10 11]]]
    >>> y = keras.layers.Cropping1D(cropping=1)(x)
    >>> y
    [[[2 3]]
     [[8 9]]]

    Args:
        cropping: Int, or tuple of int (length 2), or dictionary.
            - If int: how many units should be trimmed off at the beginning and
              end of the cropping dimension (axis 1).
            - If tuple of 2 ints: how many units should be trimmed off at the
              beginning and end of the cropping dimension
              (`(left_crop, right_crop)`).

    Input shape:
        3D tensor with shape `(batch_size, axis_to_crop, features)`

    Output shape:
        3D tensor with shape `(batch_size, cropped_axis, features)`
    c                     t        |   di | t        j                  |ddd      | _        t        d      | _        y )N   croppingT)
allow_zero   )ndim )super__init__r   standardize_tupler   r   
input_spec)selfr   kwargs	__class__s      U/home/dcms/DCMS/lib/python3.12/site-packages/keras/src/layers/reshaping/cropping1d.pyr   zCropping1D.__init__,   s<    "6"+==a
 $+    c                     |d   E|d   | j                   d   z
  | j                   d   z
  }|dk  rt        d| d| j                          d }|d   ||d   fS )N   r   zh`cropping` parameter of `Cropping1D` layer must be smaller than the input length. Received: input_shape=, cropping=r
   )r   
ValueError)r   input_shapelengths      r   compute_output_shapezCropping1D.compute_output_shape3   s{    q>% ^dmmA&66q9IIF{ L"m;t}}o?  FAA77r   c                 `   |j                   d   Jt        | j                        |j                   d   k\  r%t        d|j                    d| j                         | j                  d   dk(  r|d d | j                  d   d d d f   S |d d | j                  d   | j                  d    d d f   S )Nr   zi`cropping` parameter of `Cropping1D` layer must be smaller than the input length. Received: inputs.shape=r   r   )shapesumr   r   )r   inputss     r   callzCropping1D.call@   s    LLO'DMM"fll1o5I<<.DMM?< 
 ==q !T]]1-/233!T]]1-q1A0AA1DEEr   c                 H    d| j                   i}t        | 	         }i ||S )Nr   )r   r   
get_config)r   configbase_configr   s      r   r&   zCropping1D.get_configO   s.    dmm,g(*(+(((r   ))r   r   )	__name__
__module____qualname____doc__r   r   r$   r&   __classcell__)r   s   @r   r   r      s#    !F,8F) )r   r   N)	keras.src.api_exportr   keras.src.layers.input_specr   keras.src.layers.layerr   keras.src.utilsr   r   r   r   r   <module>r2      s5    - 1 ( / '(J) J) )J)r   