Unverified Commit aa753263 authored by Francisco Massa's avatar Francisco Massa Committed by GitHub
Browse files

Remove torchscript workaround for center_crop (#3118)

This has been fixed in PyTorch in https://github.com/pytorch/pytorch/pull/40897
parent 63251809
......@@ -463,14 +463,8 @@ def center_crop(img: Tensor, output_size: List[int]) -> Tensor:
image_width, image_height = _get_image_size(img)
crop_height, crop_width = output_size
# crop_top = int(round((image_height - crop_height) / 2.))
# Result can be different between python func and scripted func
# Temporary workaround:
crop_top = int((image_height - crop_height + 1) * 0.5)
# crop_left = int(round((image_width - crop_width) / 2.))
# Result can be different between python func and scripted func
# Temporary workaround:
crop_left = int((image_width - crop_width + 1) * 0.5)
crop_top = int(round((image_height - crop_height) / 2.))
crop_left = int(round((image_width - crop_width) / 2.))
return crop(img, crop_top, crop_left, crop_height, crop_width)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment