
    6bi                     v    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	\
5      5       rg)
z$Contains the SpatialDropout3D layer.    N)backend)	InputSpec)Dropout)keras_exportzkeras.layers.SpatialDropout3Dc                   6   ^  \ rS rSrSrSU 4S jjrS rSrU =r$ )SpatialDropout3D   a  Spatial 3D version of Dropout.

This version performs the same function as Dropout, however, it drops
entire 3D feature maps instead of individual elements. If adjacent voxels
within feature maps are strongly correlated (as is normally the case in
early convolution layers) then regular dropout will not regularize the
activations and will otherwise just result in an effective learning rate
decrease. In this case, SpatialDropout3D will help promote independence
between feature maps and should be used instead.

Args:
  rate: Float between 0 and 1. Fraction of the input units to drop.
  data_format: 'channels_first' or 'channels_last'. In 'channels_first'
    mode, the channels dimension (the depth) is at index 1, in
    'channels_last' mode is it at index 4. When unspecified, uses
    `image_data_format` value found in your TF-Keras config file at
    `~/.keras/keras.json` (if exists) else 'channels_last'.
    Defaults to 'channels_last'.
Call arguments:
  inputs: A 5D tensor.
  training: Python boolean indicating whether the layer should behave in
    training mode (adding dropout) or in inference mode (doing nothing).
Input shape:
  5D tensor with shape: `(samples, channels, dim1, dim2, dim3)` if
    data_format='channels_first'
  or 5D tensor with shape: `(samples, dim1, dim2, dim3, channels)` if
    data_format='channels_last'.
Output shape: Same as input.
References: - [Efficient Object Localization Using Convolutional
    Networks](https://arxiv.org/abs/1411.4280)
c                    > [         TU ]  " U40 UD6  Uc  [        R                  " 5       nUS;  a  [	        SU S35      eX l        [        SS9U l        g )N>   channels_lastchannels_firstzQ`data_format` must be "channels_last" or "channels_first". Received: data_format=.   )ndim)super__init__r   image_data_format
ValueErrordata_formatr   
input_spec)selfrater   kwargs	__class__s       n/home/james-whalen/.local/lib/python3.13/site-packages/tf_keras/src/layers/regularization/spatial_dropout3d.pyr   SpatialDropout3D.__init__>   sd    ((!335KAA))4Q8  '#+    c                     [         R                  " U5      nU R                  S:X  a  US   US   SSS4$ U R                  S:X  a  US   SSSUS   4$ g )Nr   r      r      )tfshaper   )r   inputsinput_shapes      r   _get_noise_shape!SpatialDropout3D._get_noise_shapeJ   sd    hhv&//NKNAq!<<0NAq![^<< 1r   )r   r   )N)	__name__
__module____qualname____firstlineno____doc__r   r$   __static_attributes____classcell__)r   s   @r   r   r      s    @
,= =r   r   )r*   tensorflow.compat.v2compatv2r    tf_keras.srcr   tf_keras.src.engine.input_specr   *tf_keras.src.layers.regularization.dropoutr    tensorflow.python.util.tf_exportr   r    r   r   <module>r5      sA    + " !   4 > : -.2=w 2= /2=r   