
    6bi'                         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	\R                  5      5       rg)
z!Contains the GaussianNoise layer.    N)backend)
base_layer)tf_utils)keras_exportzkeras.layers.GaussianNoisec                   j   ^  \ rS rSrSrSU 4S jjrSS jrU 4S jr\R                  S 5       r
SrU =r$ )	GaussianNoise   aX  Apply additive zero-centered Gaussian noise.

This is useful to mitigate overfitting
(you could see it as a form of random data augmentation).
Gaussian Noise (GS) is a natural choice as corruption process
for real valued inputs.

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

Args:
  stddev: Float, standard deviation of the noise distribution.
  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 noise) or in inference mode (doing nothing).

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                 P   > [         TU ]  " SSU0UD6  SU l        Xl        X l        g )NseedT )super__init__supports_maskingstddevr   )selfr   r   kwargs	__class__s       k/home/james-whalen/.local/lib/python3.13/site-packages/tf_keras/src/layers/regularization/gaussian_noise.pyr   GaussianNoise.__init__9   s*    -d-f- $	    c                 @   ^ ^ UU 4S jn[         R                  " UTUS9$ )Nc                     > T TR                   R                  [        R                  " T 5      STR                  T R
                  S9-   $ )Ng        )shapemeanr   dtype)_random_generatorrandom_normaltfr   r   r   )inputsr   s   r   noised"GaussianNoise.call.<locals>.noised@   sF    D22@@hhv&{{ll	 A   r   )training)r   in_train_phase)r   r   r"   r    s   ``  r   callGaussianNoise.call?   s    	 %%ffxHHr   c                    > U R                   U R                  S.n[        TU ]  5       n[	        [        UR                  5       5      [        UR                  5       5      -   5      $ )N)r   r   )r   r   r   
get_configdictlistitems)r   configbase_configr   s      r   r'   GaussianNoise.get_configJ   sK     KK;g(*D**,-V\\^0DDEEr   c                     U$ Nr   )r   input_shapes     r   compute_output_shape"GaussianNoise.compute_output_shapeO   s    r   )r   r   r   r/   )__name__
__module____qualname____firstlineno____doc__r   r$   r'   r   shape_type_conversionr1   __static_attributes____classcell__)r   s   @r   r   r      s3    6	IF
 ## $r   r   )r7   tensorflow.compat.v2compatv2r   tf_keras.srcr   tf_keras.src.enginer   tf_keras.src.utilsr    tensorflow.python.util.tf_exportr   BaseRandomLayerr   r   r   r   <module>rC      sG    ( " !   * ' : *+4J.. 4 ,4r   