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

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

        Returns:
            PIL Image or Tensor: Randomly transformed image.
        """

        fill = self.fill
        if isinstance(img, Tensor):
            if isinstance(fill, (int, float)):
                fill = [float(fill)] * F._get_image_num_channels(img)
            else:
                fill = [float(f) for f in fill]

        if torch.rand(1) < self.p:
            width, height = F._get_image_size(img)
            startpoints, endpoints = self.get_params(width, height,
                                                     self.distortion_scale)
            return F.perspective(img, startpoints, endpoints,
                                 self.interpolation, fill)
        return img
def forward ( self , img ) : fill = self . fill if isinstance ( img , Tensor ) : if isinstance ( fill , ( int , float ) ) : fill = [ float ( fill ) ] * F . _get_image_num_channels ( img ) else : fill = [ float ( f ) for f in fill ] if torch . rand ( 1 ) < self . p : width , height = F . _get_image_size ( img ) startpoints , endpoints = self . get_params ( width , height , self . distortion_scale ) return F . perspective ( img , startpoints , endpoints , self . interpolation , fill ) return img