Skip to content

Commit 8a8b35b

Browse files
committed
Add basic check for int32
1 parent 1106a25 commit 8a8b35b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/test_transforms_v2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,6 +2179,7 @@ def test_uint16(self):
21792179

21802180
img_uint8 = F.to_dtype(img_uint16, torch.uint8, scale=True)
21812181
img_float32 = F.to_dtype(img_uint16, torch.float32, scale=True)
2182+
img_int32 = F.to_dtype(img_uint16, torch.int32, scale=True)
21822183

21832184
assert_equal(img_uint8, (img_uint16 / 256).to(torch.uint8))
21842185
assert_close(img_float32, (img_uint16 / 65535))
@@ -2187,6 +2188,7 @@ def test_uint16(self):
21872188
# Ideally we'd check against (img_uint16 & 0xFF00) but bitwise and isn't supported for it yet
21882189
# so we simulate it by scaling down and up again.
21892190
assert_equal(F.to_dtype(img_uint8, torch.uint16, scale=True), ((img_uint16 / 256).to(torch.uint16) * 256))
2191+
assert_equal(F.to_dtype(img_int32, torch.uint16, scale=True), img_uint16)
21902192

21912193
assert_equal(F.to_dtype(img_float32, torch.uint8, scale=True), img_uint8)
21922194
assert_close(F.to_dtype(img_uint8, torch.float32, scale=True), img_float32, rtol=0, atol=1e-2)

0 commit comments

Comments
 (0)