Unverified Commit df6a7960 authored by Andreas Georgiou's avatar Andreas Georgiou Committed by GitHub
Browse files

Fixed resize to only match the smaller edge when an int is given (#2518)

* Fixed resize to only match the smaller edge when an int is given instead of always

* Added test cases for resize()
parent 3a159dfe
...@@ -337,7 +337,7 @@ class Tester(unittest.TestCase): ...@@ -337,7 +337,7 @@ class Tester(unittest.TestCase):
if dt is not None: if dt is not None:
# This is a trivial cast to float of uint8 data to test all cases # This is a trivial cast to float of uint8 data to test all cases
tensor = tensor.to(dt) tensor = tensor.to(dt)
for size in [32, [32, ], [32, 32], (32, 32), ]: for size in [32, 26, [32, ], [32, 32], (32, 32), [26, 35]]:
for interpolation in [BILINEAR, BICUBIC, NEAREST]: for interpolation in [BILINEAR, BICUBIC, NEAREST]:
resized_tensor = F_t.resize(tensor, size=size, interpolation=interpolation) resized_tensor = F_t.resize(tensor, size=size, interpolation=interpolation)
resized_pil_img = F_pil.resize(pil_img, size=size, interpolation=interpolation) resized_pil_img = F_pil.resize(pil_img, size=size, interpolation=interpolation)
......
...@@ -226,7 +226,7 @@ class Tester(unittest.TestCase): ...@@ -226,7 +226,7 @@ class Tester(unittest.TestCase):
if dt is not None: if dt is not None:
# This is a trivial cast to float of uint8 data to test all cases # This is a trivial cast to float of uint8 data to test all cases
tensor = tensor.to(dt) tensor = tensor.to(dt)
for size in [32, [32, ], [32, 32], (32, 32), ]: for size in [32, 34, [32, ], [32, 32], (32, 32), [34, 35]]:
for interpolation in [BILINEAR, BICUBIC, NEAREST]: for interpolation in [BILINEAR, BICUBIC, NEAREST]:
resized_tensor = F.resize(tensor, size=size, interpolation=interpolation) resized_tensor = F.resize(tensor, size=size, interpolation=interpolation)
...@@ -250,7 +250,7 @@ class Tester(unittest.TestCase): ...@@ -250,7 +250,7 @@ class Tester(unittest.TestCase):
for scale in [(0.7, 1.2), [0.7, 1.2]]: for scale in [(0.7, 1.2), [0.7, 1.2]]:
for ratio in [(0.75, 1.333), [0.75, 1.333]]: for ratio in [(0.75, 1.333), [0.75, 1.333]]:
for size in [(32, ), [32, ], [32, 32], (32, 32)]: for size in [(32, ), [44, ], [32, ], [32, 32], (32, 32), [44, 55]]:
for interpolation in [NEAREST, BILINEAR, BICUBIC]: for interpolation in [NEAREST, BILINEAR, BICUBIC]:
transform = T.RandomResizedCrop( transform = T.RandomResizedCrop(
size=size, scale=scale, ratio=ratio, interpolation=interpolation size=size, scale=scale, ratio=ratio, interpolation=interpolation
......
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