
    6bi                     v    S r SSKJs  Jr  SSKJr  SSKJr  SSK	J
r
  SSKJr  \" S5       " S S	\5      5       rg)
z"Keras cropping layer for 1D input.    N)Layer)	InputSpec)
conv_utils)keras_exportzkeras.layers.Cropping1Dc                   H   ^  \ rS rSrSrSU 4S jjrS rS rU 4S jrSr	U =r
$ )	
Cropping1D   a  Cropping layer for 1D input (e.g. temporal sequence).

It crops along the time dimension (axis 1).

Examples:

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

Args:
  cropping: Int or tuple of int (length 2)
    How many units should be trimmed off at the beginning and end of
    the cropping dimension (axis 1).
    If a single int is provided, the same value will be used for both.

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

Output shape:
  3D tensor with shape `(batch_size, cropped_axis, features)`
c                 z   > [         TU ]  " S0 UD6  [        R                  " USSSS9U l        [        SS9U l        g )N   croppingT)
allow_zero   )ndim )super__init__r   normalize_tupler   r   
input_spec)selfr   kwargs	__class__s      b/home/james-whalen/.local/lib/python3.13/site-packages/tf_keras/src/layers/reshaping/cropping1d.pyr   Cropping1D.__init__@   s<    "6""22a
 $+    c                     [         R                  " U5      R                  5       nUS   b&  US   U R                  S   -
  U R                  S   -
  nOS n[         R                  " US   X!S   /5      $ )N   r   r   )tfTensorShapeas_listr   )r   input_shapelengths      r   compute_output_shapeCropping1D.compute_output_shapeG   si    nn[199;q>% ^dmmA&66q9IIFF~~{1~v1~FGGr   c                 f   UR                   S   bK  [        U R                  5      UR                   S   :  a%  [        SUR                    SU R                   35      eU R                  S   S:X  a  US S 2U R                  S   S 2S S 24   $ US S 2U R                  S   U R                  S   * 2S S 24   $ )Nr   zbcropping parameter of Cropping layer must be greater than the input shape. Received: inputs.shape=z, and cropping=r   )shapesumr   
ValueError)r   inputss     r   callCropping1D.callO   s    LLO'DMM"fll1o5H<<.@ 
 ==q !T]]1-/233!T]]1-q1A0AA1DEEr   c                    > SU R                   0n[        TU ]	  5       n[        [	        UR                  5       5      [	        UR                  5       5      -   5      $ )Nr   )r   r   
get_configdictlistitems)r   configbase_configr   s      r   r,   Cropping1D.get_config^   sG    dmm,g(*D**,-V\\^0DDEEr   )r   r   ))r   r   )__name__
__module____qualname____firstlineno____doc__r   r"   r)   r,   __static_attributes____classcell__)r   s   @r   r   r      s&     D,HFF Fr   r   )r7   tensorflow.compat.v2compatv2r   tf_keras.src.engine.base_layerr   tf_keras.src.engine.input_specr   tf_keras.src.utilsr    tensorflow.python.util.tf_exportr   r   r   r   r   <module>rA      sG    ) " ! 0 4 ) : '(DF DF )DFr   