o
    2h                     @   s@   d dl mZ d dlmZ d dlmZ edG dd deZdS )    )regularizers)keras_export)Layerz#keras.layers.ActivityRegularizationc                       s>   e Zd ZdZd fdd	Zdd Zdd Z fd	d
Z  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                    s>   t  jddtj||di| d| _|| _|| _|   d S )Nactivity_regularizerl1l2T )super__init__r   L1L2supports_maskingr	   r
   _build_at_init)selfr	   r
   kwargs	__class__r   r/var/www/html/chatgem/venv/lib/python3.10/site-packages/keras/src/layers/regularization/activity_regularization.pyr      s   
zActivityRegularization.__init__c                 C      |S Nr   )r   inputsr   r   r   call!      zActivityRegularization.callc                 C   r   r   r   )r   input_shaper   r   r   compute_output_shape$   r   z+ActivityRegularization.compute_output_shapec                    s0   t   }|dd  | j| jd}i ||S )Nr   r   )r   
get_configpopr	   r
   )r   base_configconfigr   r   r   r   '   s   
z!ActivityRegularization.get_config)r   r   )	__name__
__module____qualname____doc__r   r   r   r   __classcell__r   r   r   r   r      s    
r   N)	keras.srcr   keras.src.api_exportr   keras.src.layers.layerr   r   r   r   r   r   <module>   s
    