(self, img)
return F.crop(img, i, j, h, w)
Args:
            img (PIL Image or Tensor): Image to be cropped.

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

        Returns:
            PIL Image or Tensor: Cropped image.
        """
        if self.padding is not None:
            img = F.pad(img, self.padding, self.fill, self.padding_mode)

        width, height = F._get_image_size(img)
        # pad the width if needed
        if self.pad_if_needed and width < self.size[1]:
            padding = [self.size[1] - width, 0]
            img = F.pad(img, padding, self.fill, self.padding_mode)
        # pad the height if needed
        if self.pad_if_needed and height < self.size[0]:
            padding = [0, self.size[0] - height]
            img = F.pad(img, padding, self.fill, self.padding_mode)

        i, j, h, w = self.get_params(img, self.size)

        return F.crop(img, i, j, h, w)
def forward ( self , img ) : if self . padding is not None : img = F . pad ( img , self . padding , self . fill , self . padding_mode ) width , height = F . _get_image_size ( img ) # pad the width if needed if self . pad_if_needed and width < self . size [ 1 ] : padding = [ self . size [ 1 ] - width , 0 ] img = F . pad ( img , padding , self . fill , self . padding_mode ) # pad the height if needed if self . pad_if_needed and height < self . size [ 0 ] : padding = [ 0 , self . size [ 0 ] - height ] img = F . pad ( img , padding , self . fill , self . padding_mode ) i , j , h , w = self . get_params ( img , self . size ) return F . crop ( img , i , j , h , w )