fn
dropout2d
→Tensordropout2d(x: Tensor, p: float = 0.5, training: bool = True)Channel-wise dropout for 2-D (spatial) feature maps.
Drops entire 2-D feature maps of an tensor
with probability p and rescales the survivors by
. This is the dropout variant of choice for
convolutional networks (Tompson et al. 2015 "SpatialDropout"):
adjacent pixels within a feature map are spatially correlated,
so elementwise dropout removes very little information.
Channel-wise masking forces independence between feature maps
instead.
Parameters
xTensorInput tensor of shape .
pfloat= 0.5Channel-drop probability in (default
0.5).trainingbool= TrueWhen
False, identity (default True).Returns
TensorSame shape and dtype as x.
Notes
For each batch element and channel , draw and broadcast over the spatial dimensions:
Examples
>>> import lucid
>>> from lucid.nn.functional import dropout2d
>>> x = lucid.ones((2, 8, 4, 4))
>>> y = dropout2d(x, p=0.5, training=True)