Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3e81aef
fix prototype kernels
pmeier Oct 24, 2022
33852be
fix stable kernels
pmeier Oct 24, 2022
3a92412
fix tests
pmeier Oct 25, 2022
e13613a
make test more robust
pmeier Oct 25, 2022
a400225
Merge branch 'main' into fix-hardcoded-255
pmeier Oct 25, 2022
e053125
Merge branch 'main' into fix-hardcoded-255
pmeier Oct 25, 2022
3327e04
improve invert for signed integers
pmeier Oct 27, 2022
91e8c66
Merge branch 'main' into fix-hardcoded-255
datumbox Oct 27, 2022
bdd8127
Merge branch 'main' into fix-hardcoded-255
pmeier Oct 28, 2022
c672425
improve invert
pmeier Oct 28, 2022
6375627
fix posterize
pmeier Oct 28, 2022
6895f71
Merge branch 'main' into fix-hardcoded-255
pmeier Oct 28, 2022
c0236fc
Revert "assume that integer images are [0, 255] in equalize (#6859)"
pmeier Oct 28, 2022
8713528
Merge branch 'fix-hardcoded-255' of https://github.com/pmeier/vision …
pmeier Oct 28, 2022
9acf2f4
Merge branch 'main' into fix-hardcoded-255
pmeier Nov 2, 2022
402b01f
fix solarize in AA
pmeier Nov 2, 2022
d0394b7
Merge branch 'main' into fix-hardcoded-255
pmeier Nov 3, 2022
5f33f4a
fix resize
pmeier Nov 3, 2022
3a13a08
Revert "fix resize"
pmeier Nov 3, 2022
7765a47
Merge branch 'main' into fix-hardcoded-255
pmeier Nov 3, 2022
2d0549d
Merge branch 'main' into fix-hardcoded-255
pmeier Nov 3, 2022
f594ceb
Merge branch 'main' into fix-hardcoded-255
pmeier Nov 3, 2022
48603b0
add comment to float max value
pmeier Nov 3, 2022
a61d44f
Merge branch 'fix-hardcoded-255' of https://github.com/pmeier/vision …
pmeier Nov 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions torchvision/prototype/transforms/functional/_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ def resize_image_tensor(
)

if need_cast:
if interpolation == InterpolationMode.BICUBIC and dtype == torch.uint8:
image = image.clamp_(min=0, max=255)
# bicubic interpolation can overshoot
if interpolation == InterpolationMode.BICUBIC:
image = image.clamp_(min=0, max=_FT._max_value(dtype))
image = image.round_().to(dtype=dtype)

return image.reshape(shape[:-3] + (num_channels, new_height, new_width))
Expand Down
4 changes: 2 additions & 2 deletions torchvision/transforms/functional_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@ def resize(

img = interpolate(img, size=size, mode=interpolation, align_corners=align_corners, antialias=antialias)

if interpolation == "bicubic" and out_dtype == torch.uint8:
img = img.clamp(min=0, max=255)
if interpolation == "bicubic" and out_dtype not in (torch.float32, torch.float64):
img = img.clamp(min=0, max=_max_value(out_dtype))

img = _cast_squeeze_out(img, need_cast=need_cast, need_squeeze=need_squeeze, out_dtype=out_dtype)

Expand Down