(self, img)
return img
Args:
            img (Tensor): Tensor image to be erased.

        Returns:
            img (Tensor): Erased Tensor image.
Args:
            img (Tensor): Tensor image to be erased.
Args : img ( Tensor ) : Tensor image to be erased .
def forward(self, img):
        """
        Args:
            img (Tensor): Tensor image to be erased.

        Returns:
            img (Tensor): Erased Tensor image.
        """
        if torch.rand(1) < self.p:

            # cast self.value to script acceptable type
            if isinstance(self.value, (int, float)):
                value = [self.value, ]
            elif isinstance(self.value, str):
                value = None
            elif isinstance(self.value, tuple):
                value = list(self.value)
            else:
                value = self.value

            if value is not None and not (len(value) in (1, img.shape[-3])):
                raise ValueError(
                    "If value is a sequence, it should have either a single value or "
                    "{} (number of input channels)".format(img.shape[-3]))

            x, y, h, w, v = self.get_params(
                img, scale=self.scale, ratio=self.ratio, value=value)
            return F.erase(img, x, y, h, w, v, self.inplace)
        return img
def forward ( self , img ) : if torch . rand ( 1 ) < self . p : # cast self.value to script acceptable type if isinstance ( self . value , ( int , float ) ) : value = [ self . value , ] elif isinstance ( self . value , str ) : value = None elif isinstance ( self . value , tuple ) : value = list ( self . value ) else : value = self . value if value is not None and not ( len ( value ) in ( 1 , img . shape [ - 3 ] ) ) : raise ValueError ( "If value is a sequence, it should have either a single value or " "{} (number of input channels)" . format ( img . shape [ - 3 ] ) ) x , y , h , w , v = self . get_params ( img , scale = self . scale , ratio = self . ratio , value = value ) return F . erase ( img , x , y , h , w , v , self . inplace ) return img