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

Function center_crop

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

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

(inpt: torch.Tensor, output_size: list[int])

Source from the content-addressed store, hash-verified

2515
2516
2517def center_crop(inpt: torch.Tensor, output_size: list[int]) -> torch.Tensor:
2518 """See :class:`~torchvision.transforms.v2.CenterCrop` for details."""
2519 if torch.jit.is_scripting():
2520 return center_crop_image(inpt, output_size=output_size)
2521
2522 _log_api_usage_once(center_crop)
2523
2524 kernel = _get_kernel(center_crop, type(inpt))
2525 return kernel(inpt, output_size=output_size)
2526
2527
2528def _center_crop_parse_output_size(output_size: list[int]) -> list[int]:

Callers

nothing calls this directly

Calls 3

_log_api_usage_onceFunction · 0.90
center_crop_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…