
    2Vh                     |    d dl Z 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j                               Zy)	    N)backend)layers)ops)keras_exportzkeras.layers.GaussianDropoutc                   <     e Zd ZdZd fd	ZddZd Z fdZ xZS )GaussianDropouta\  Apply multiplicative 1-centered Gaussian noise.

    As it is a regularization layer, it is only active at training time.

    Args:
        rate: Float, drop probability (as with `Dropout`).
            The multiplicative noise will have
            standard deviation `sqrt(rate / (1 - rate))`.
        seed: Integer, optional random seed to enable deterministic behavior.

    Call arguments:
        inputs: Input tensor (of any rank).
        training: Python boolean indicating whether the layer should behave in
            training mode (adding dropout) or in inference mode (doing nothing).
    c                     t        |   di | d|cxk  rdk  sn t        d|       || _        || _        |dkD  r$t
        j                  j                  |      | _        d| _	        | j                          y )Nr      zcInvalid value received for argument `rate`. Expected a float value between 0 and 1. Received: rate=T )super__init__
ValueErrorrateseedr   randomSeedGeneratorseed_generatorsupports_masking_build_at_init)selfr   r   kwargs	__class__s       `/home/dcms/DCMS/lib/python3.12/site-packages/keras/src/layers/regularization/gaussian_dropout.pyr   zGaussianDropout.__init__   s|    "6"D~A~""&) 
 		!8")..">">t"DD $    c                 "   |r| j                   dkD  r}t        j                  | j                   d| j                   z
  z        }|t        j                  j                  t        j                  |      d|| j                  | j                        z  S |S )Nr   g      ?)shapemeanstddevdtyper   )
r   mathsqrtr   r   normalr   r   compute_dtyper   )r   inputstrainingr   s       r   callzGaussianDropout.call+   s|    		AYYtyyC$))O<=FGNN11ii'(((( 2    r   c                     |S Nr   )r   input_shapes     r   compute_output_shapez$GaussianDropout.compute_output_shape7   s    r   c                 ^    t         |          }| j                  | j                  d}i ||S )N)r   r   )r   
get_configr   r   )r   base_configconfigr   s      r   r,   zGaussianDropout.get_config:   s7    g(*IIII
 )+(((r   r(   )F)	__name__
__module____qualname____doc__r   r&   r*   r,   __classcell__)r   s   @r   r   r   	   s!      
) )r   r   )	r    	keras.srcr   r   r   keras.src.api_exportr   Layerr   r   r   r   <module>r7      s9        - ,-6)fll 6) .6)r   