You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But when I use the two functions on Windows, I found that it still only support PIL as inputs. I'd like to use tensor as inputs. Some of the source code in functional.py is:
defresize(img, size, interpolation=Image.BILINEAR):
r"""Resize the input PIL Image to the given size. Args: img (PIL Image): Image to be resized. size (sequence or int): Desired output size. If size is a sequence like (h, w), the output size will be matched to this. If size is an int, the smaller edge of the image will be matched to this number maintaining the aspect ratio. i.e, if height > width, then image will be rescaled to :math:`\left(\text{size} \times \frac{\text{height}}{\text{width}}, \text{size}\right)` interpolation (int, optional): Desired interpolation. Default is ``PIL.Image.BILINEAR`` Returns: PIL Image: Resized image. """ifnot_is_pil_image(img):
raiseTypeError('img should be PIL Image. Got {}'.format(type(img)))
ifnot (isinstance(size, int) or (isinstance(size, Iterable) andlen(size) ==2)):
raiseTypeError('Got inappropriate size arg: {}'.format(size))
ifisinstance(size, int):
w, h=img.sizeif (w<=handw==size) or (h<=wandh==size):
returnimgifw<h:
ow=sizeoh=int(size*h/w)
returnimg.resize((ow, oh), interpolation)
else:
oh=sizeow=int(size*w/h)
returnimg.resize((ow, oh), interpolation)
else:
returnimg.resize(size[::-1], interpolation)
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
❓ Questions and Help
Windows 10:
CUDA version :10.1
torchvision.version is 0.7.0
python: 3.7
The docs on the website: torchvision.transforms.functional.resize() and torchvision.transforms.functional.crop() are written that the two functions support both PIL and tensor as inputs.
But when I use the two functions on Windows, I found that it still only support PIL as inputs. I'd like to use tensor as inputs. Some of the source code in functional.py is:
The text was updated successfully, but these errors were encountered: