drop_block2d

dragon.vm.torch.nn.functional.drop_block2d(
  input,
  kp=0.9,
  block_size=7,
  alpha=1.0,
  decrement=0.0,
  training=True,
  inplace=False,
  slot=None
)[source]

Set the spatial blocks over input to zero randomly.

The DropBlock function is defined as:

\[\text{DropBlock}(x) = x \cdot \text{Bernoulli}(\alpha\cdot\gamma) \\ \quad \\ \text{where}\quad \gamma = \frac{keep\_prob}{block\_size^{n}} \frac{feat\_size^{n}}{(feat\_size - block\_size + 1)^n} \]
Parameters:
  • input (dragon.vm.torch.Tensor) – The input tensor.
  • kp (float, optional, default=0.9) – The keeping prob.
  • block_size (int, optional, default=7) – The size of a spatial block.
  • alpha (float, optional, default=1.) – The scale factor to \(\gamma\).
  • decrement (float, optional, default=0.) – The decrement value to kp.
  • training (bool, optional, default=True) – The training flag.
  • inplace (bool, optional, default=False) – Whether to do the operation in-place.
  • slot (int, optional) – The optional slot index.
Returns:

dragon.vm.torch.Tensor – The output tensor.