
    2Vh                     T    d dl mZ d dlmZ d dlmZ  ed       G d de             Zy)    )regularizers)keras_export)Layerz#keras.layers.ActivityRegularizationc                   :     e Zd ZdZd fd	Zd Zd Z fdZ xZS )ActivityRegularizationa  Layer that applies an update to the cost function based input activity.

    Args:
        l1: L1 regularization factor (positive float).
        l2: L2 regularization factor (positive float).

    Input shape:
        Arbitrary. Use the keyword argument `input_shape`
        (tuple of integers, does not include the samples axis)
        when using this layer as the first layer in a model.

    Output shape:
        Same shape as input.
    c                     t        |   ddt        j                  ||      i| d| _        || _        || _        | j                          y )Nactivity_regularizerl1l2T )super__init__r   L1L2supports_maskingr   r   _build_at_init)selfr   r   kwargs	__class__s       g/home/dcms/DCMS/lib/python3.12/site-packages/keras/src/layers/regularization/activity_regularization.pyr   zActivityRegularization.__init__   sQ     	
!-!2!2bR!@	
DJ	
 !%    c                     |S Nr   )r   inputss     r   callzActivityRegularization.call!   s    r   c                     |S r   r   )r   input_shapes     r   compute_output_shapez+ActivityRegularization.compute_output_shape$   s    r   c                     t         |          }|j                  dd        | j                  | j                  d}i ||S )Nr	   r
   )r   
get_configpopr   r   )r   base_configconfigr   s      r   r    z!ActivityRegularization.get_config'   sA    g(*.5tww/(+(((r   )        r$   )	__name__
__module____qualname____doc__r   r   r   r    __classcell__)r   s   @r   r   r      s!    ) )r   r   N)	keras.srcr   keras.src.api_exportr   keras.src.layers.layerr   r   r   r   r   <module>r-      s/    " - ( 34$)U $) 5$)r   