[docs]classDropBlock2d(nn.Module):"""Implements the DropBlock module from `"DropBlock: A regularization method for convolutional networks" <https://arxiv.org/pdf/1810.12890.pdf>`_ Args: p (float): probability of dropping activation value block_size (int): size of each block that is expended from the sampled mask inplace (bool, optional): whether the operation should be done inplace """def__init__(self,p,block_size,inplace=False):super().__init__()self.p=pself.block_size=block_sizeself.inplace=inplace@propertydefdrop_prob(self):returnself.p/self.block_size**2defforward(self,x):returnF.dropblock2d(x,self.drop_prob,self.block_size,self.inplace)defextra_repr(self):returnf"p={self.p}, block_size={self.block_size}, inplace={self.inplace}"