class_docstr: Randomly zeroes 2D spatial blocks of the input tensor.
  As described in the paper
  `DropBlock: A regularization method for convolutional networks`_ ,
  dropping whole blocks of feature map allows to remove semantic
  information as compared to regular dropout.
  Args:
      drop_prob (float): probability of an element to be dropped.
      block_size (int): size of the block to drop
  Shape:
      - Input: `(N, C, H, W)`
      - Output: `(N, C, H, W)`
  .. _DropBlock: A regularization method for convolutional networks:
     https://arxiv.org/abs/1810.12890
class_docstr_tok: ["Randomly","zeroes","2D","spatial","blocks","of","the","input","tensor",".","As","described","in","the","paper","`","DropBlock",":","A","regularization","method","for","convolutional","networks","`","_",",","dropping","whole","blocks","of","feature","map","allows","to","remove","semantic","information","as","compared","to","regular","dropout",".","Args",":","drop_prob","(","float",")",":","probability","of","an","element","to","be","dropped",".","block_size","(","int",")",":","size","of","the","block","to","drop","Shape",":","-","Input",":","`","(","N",",","C",",","H",",","W",")","`","-","Output",":","`","(","N",",","C",",","H",",","W",")","`","..","_DropBlock",":","A","regularization","method","for","convolutional","networks",":","https",":","\/\/arxiv.org\/abs\/1810.12890"]
code: def forward(self, x):
      # shape: (bsize, channels, height, width)
  
      assert (
          x.dim() == 4
      ), "Expected input with 4 dimensions (bsize, channels, height, width)"
  
      if not self.training or self.drop_prob == 0.0:
          return x
      else:
          # get gamma value
          gamma = self._compute_gamma(x)
  
          # sample mask and place on input device
          mask = (torch.rand(x.shape[0], *x.shape[2:]) < gamma).to(x)
  
          # compute block mask
          block_mask, keeped = self._compute_block_mask(mask)
  
          # apply block mask
          out = x * block_mask[:, None, :, :]
  
          # scale output
          out = out * (block_mask.numel() / keeped).to(out)
          return out
  
file_path: pytorch-toolbelt/pytorch_toolbelt/modules/dropblock.py
imports: import torch
  import torch.nn.functional
  from torch import nn
label_desc: Use image node_id 2 for calling the DropBlock2D obj's underlying member method code with example usage: obj.forward(x) and returns: x, out