Autograd node for DropBlock — structured spatial dropout for 4-D convolutional feature maps (Ghiasi, Lin & Le 2018).
A sparse seed mask of Bernoulli samples is generated at the
per-element rate
(with = block_size) and then dilated by the backend into
contiguous keep blocks so that whole spatial patches
are zeroed together rather than uncorrelated single pixels. This is
far more effective than element-wise dropout on convolutional
outputs where neighbouring pixels are strongly correlated.
Attributes
schema_v1OpSchemaRegistered schema (name
"drop_block", version 1, AmpPolicy::KeepInput).p_doubleTarget block-level drop rate.
mask_StorageThe dilated keep mask, same shape as the input, saved for the backward multiply.
Static methods
1static
forward
→TensorImplPtrint forward(const int & a, int block_size, double p, double eps, Generator * gen)Sample the seed mask, dilate into blocks, and apply.
Parameters
aTensorImplPtr4-D input tensor of shape
(N, C, H, W).block_sizestd::int64_tSide length of each dropped block. Must be strictly positive.
pdoubleTarget block-level drop probability in .
epsdoubleNumerical guard added to the denominator when computing to avoid division by zero on small spatial extents.
genGenerator*Optional RNG (see
DropoutBackward).Returns
TensorImplPtrOutput tensor with the same shape as a.
Raises
LucidErrorIf
a is not 4-D, p is outside , block_size <= 0, or deterministic mode is on without a Generator.