Skip to content

Commit 35de04c

Browse files
committed
Adding PIL vs TorchVision test for min==max
1 parent cb7d27a commit 35de04c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/test_transforms.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,15 @@ def test_randomness(fn, trans, kwargs, seed, p):
573573
trans(**kwargs).__repr__()
574574

575575

576+
def test_autocontrast_equal_minmax():
577+
img_tensor = torch.tensor([[[10]], [[128]], [[245]]], dtype=torch.uint8).expand(3, 32, 32)
578+
img_pil = F.to_pil_image(img_tensor)
579+
580+
img_tensor = F.autocontrast(img_tensor)
581+
img_pil = F.autocontrast(img_pil)
582+
torch.testing.assert_close(img_tensor, F.pil_to_tensor(img_pil))
583+
584+
576585
class TestToPil:
577586
def _get_1_channel_tensor_various_types():
578587
img_data_float = torch.Tensor(1, 4, 4).uniform_()

0 commit comments

Comments
 (0)