Resize — Torchvision 0.22 documentation (original) (raw)

class torchvision.transforms.v2.Resize(size: Optional[Union[int, Sequence[int]]], interpolation: Union[InterpolationMode, int] = InterpolationMode.BILINEAR, max_size: Optional[int] = None, antialias: Optional[bool] = True)[source]

Resize the input to the given size.

If the input is a torch.Tensor or a TVTensor (e.g. Image,Video, BoundingBoxes etc.) it can have arbitrary number of leading batch dimensions. For example, the image can have [..., C, H, W] shape. A bounding box can have [..., 4] shape.

Parameters:

Examples using Resize:

transform(inpt: Any, params: Dict[str, Any]) → Any[source]

Method to override for custom transforms.

See How to write your own v2 transforms