o
    2hx                     @   sH   d dl Z 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 )    N)activations)keras_export)Layerzkeras.layers.LeakyReLUc                       s>   e Zd ZdZd fdd	Zdd Z fddZd	d
 Z  ZS )	LeakyReLUa{  Leaky version of a Rectified Linear Unit activation layer.

    This layer allows a small gradient when the unit is not active.

    Formula:

    ``` python
    f(x) = alpha * x if x < 0
    f(x) = x if x >= 0
    ```

    Example:

    ``` python
    leaky_relu_layer = LeakyReLU(negative_slope=0.5)
    input = np.array([-10, -5, 0.0, 5, 10])
    result = leaky_relu_layer(input)
    # result = [-5. , -2.5,  0. ,  5. , 10.]
    ```

    Args:
        negative_slope: Float >= 0.0. Negative slope coefficient.
          Defaults to `0.3`.
        **kwargs: Base layer keyword arguments, such as
            `name` and `dtype`.

    333333?c                    sd   d|v r| d}td t jdi | |d u s|dk r&td| || _d| _|   d S )Nalphaz=Argument `alpha` is deprecated. Use `negative_slope` instead.r   z|The negative_slope value of a Leaky ReLU layer cannot be None or negative value. Expected a float. Received: negative_slope=T )	popwarningswarnsuper__init__
ValueErrornegative_slopesupports_masking_build_at_init)selfr   kwargs	__class__r   b/var/www/html/chatgem/venv/lib/python3.10/site-packages/keras/src/layers/activations/leaky_relu.pyr   &   s   
zLeakyReLU.__init__c                 C   s   t j|| jdS )N)r   )r   
leaky_relur   )r   inputsr   r   r   call8   s   zLeakyReLU.callc                    s   t   }|d| ji |S )Nr   )r   
get_configupdater   )r   configr   r   r   r   =   s   
zLeakyReLU.get_configc                 C   s   |S )Nr   )r   input_shaper   r   r   compute_output_shapeB   s   zLeakyReLU.compute_output_shape)r   )	__name__
__module____qualname____doc__r   r   r   r   __classcell__r   r   r   r   r      s    r   )r
   	keras.srcr   keras.src.api_exportr   keras.src.layers.layerr   r   r   r   r   r   <module>   s    