Skip to content
fn

dropout3d

→Tensor
dropout3d(input: Tensor, p: float = 0.5, training: bool = True, inplace: bool = False)

Implementing kernel

C++ engine symbols that back this Python API.

Channel-wise dropout for 3-D (volumetric) feature maps.

Drops entire 3-D feature maps of an (N,C,D,H,W)(N, C, D, H, W) tensor with probability p and rescales survivors by 1/(1−p)1/(1-p). Used in 3-D ConvNets for video and volumetric medical imaging, where spatio-temporal locality makes per- element dropout statistically inefficient (same rationale as dropout2d).

Parameters

inputTensor
Input tensor of shape (N,C,D,H,W)(N, C, D, H, W). Any other rank is taken as one sample with no batch axis, its channels on axis 0.
pfloat= 0.5
Channel-drop probability in [0,1][0, 1] (default 0.5).
trainingbool= True
When False, identity (default True).
inplacebool= False
If True, input itself is written and returned (default False).

Returns

Tensor

Same shape and dtype as input.

Notes

For each batch element nn and channel cc, draw mn,c∼Bernoulli(1−p)m_{n,c} \sim \mathrm{Bernoulli}(1 - p) and broadcast over the volumetric dimensions:

yn,c,d,h,w=mn,c1−p⋅xn,c,d,h,w.y_{n, c, d, h, w} = \frac{m_{n, c}}{1 - p} \cdot x_{n, c, d, h, w}.

Examples

>>> import lucid
>>> from lucid.nn.functional import dropout3d
>>> x = lucid.ones((1, 4, 3, 4, 4))
>>> y = dropout3d(x, p=0.5, training=True)

Used by 2