MCPcopy
hub / github.com/pytorch/vision / affine

Function affine

torchvision/transforms/v2/functional/_geometry.py:590–625  ·  view source on GitHub ↗

See :class:`~torchvision.transforms.v2.RandomAffine` for details.

(
    inpt: torch.Tensor,
    angle: Union[int, float],
    translate: list[float],
    scale: float,
    shear: list[float],
    interpolation: Union[InterpolationMode, int] = InterpolationMode.NEAREST,
    fill: _FillTypeJIT = None,
    center: Optional[list[float]] = None,
)

Source from the content-addressed store, hash-verified

588
589
590def affine(
591 inpt: torch.Tensor,
592 angle: Union[int, float],
593 translate: list[float],
594 scale: float,
595 shear: list[float],
596 interpolation: Union[InterpolationMode, int] = InterpolationMode.NEAREST,
597 fill: _FillTypeJIT = None,
598 center: Optional[list[float]] = None,
599) -> torch.Tensor:
600 """See :class:`~torchvision.transforms.v2.RandomAffine` for details."""
601 if torch.jit.is_scripting():
602 return affine_image(
603 inpt,
604 angle=angle,
605 translate=translate,
606 scale=scale,
607 shear=shear,
608 interpolation=interpolation,
609 fill=fill,
610 center=center,
611 )
612
613 _log_api_usage_once(affine)
614
615 kernel = _get_kernel(affine, type(inpt))
616 return kernel(
617 inpt,
618 angle=angle,
619 translate=translate,
620 scale=scale,
621 shear=shear,
622 interpolation=interpolation,
623 fill=fill,
624 center=center,
625 )
626
627
628def _affine_parse_args(

Callers

nothing calls this directly

Calls 3

_log_api_usage_onceFunction · 0.90
affine_imageFunction · 0.85
_get_kernelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…