(self, img)
return img
Args:
            img (PIL Image or Tensor): Image to be posterized.

        Returns:
            PIL Image or Tensor: Randomly posterized image.
Args:
            img (PIL Image or Tensor): Image to be posterized.
Args : img ( PIL Image or Tensor ) : Image to be posterized .
def forward(self, img):
        """
        Args:
            img (PIL Image or Tensor): Image to be posterized.

        Returns:
            PIL Image or Tensor: Randomly posterized image.
        """
        if torch.rand(1).item() < self.p:
            return F.posterize(img, self.bits)
        return img
def forward ( self , img ) : if torch . rand ( 1 ) . item ( ) < self . p : return F . posterize ( img , self . bits ) return img