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

Function crop

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

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

(inpt: torch.Tensor, top: int, left: int, height: int, width: int)

Source from the content-addressed store, hash-verified

1782
1783
1784def crop(inpt: torch.Tensor, top: int, left: int, height: int, width: int) -> torch.Tensor:
1785 """See :class:`~torchvision.transforms.v2.RandomCrop` for details."""
1786 if torch.jit.is_scripting():
1787 return crop_image(inpt, top=top, left=left, height=height, width=width)
1788
1789 _log_api_usage_once(crop)
1790
1791 kernel = _get_kernel(crop, type(inpt))
1792 return kernel(inpt, top=top, left=left, height=height, width=width)
1793
1794
1795@_register_kernel_internal(crop, torch.Tensor)

Callers

nothing calls this directly

Calls 3

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