affine — Torchvision 0.22 documentation (original) (raw)

torchvision.transforms.functional.affine(img: Tensor, angle: float, translate: List[int], scale: float, shear: List[float], interpolation: InterpolationMode = InterpolationMode.NEAREST, fill: Optional[List[float]] = None, center: Optional[List[int]] = None) → Tensor[source]

Apply affine transformation on the image keeping image center invariant. If the image is torch Tensor, it is expected to have […, H, W] shape, where … means an arbitrary number of leading dimensions.

Parameters:

Returns:

Transformed image.

Return type:

PIL Image or Tensor

Examples using affine: