Skip to content

Commit c4a2bb8

Browse files
committed
simplify PIL comparisions
1 parent edffe0c commit c4a2bb8

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

test/test_transforms_v2.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
assert_equal,
2626
cache,
2727
cpu_and_cuda,
28+
cvcuda_to_pil_compatible_tensor,
2829
freeze_rng_state,
2930
ignore_jit_no_profile_information_warning,
3031
make_bounding_boxes,
@@ -6427,11 +6428,7 @@ def test_image_correctness(self, num_output_channels, color_space, make_input, f
64276428
actual = fn(image, num_output_channels=num_output_channels)
64286429

64296430
if make_input is make_image_cvcuda:
6430-
actual = F.cvcuda_to_tensor(actual).to(device="cpu")
6431-
actual = actual.squeeze(0)
6432-
# drop the batch dimension
6433-
image = F.cvcuda_to_tensor(image).to(device="cpu")
6434-
image = image.squeeze(0)
6431+
image = cvcuda_to_pil_compatible_tensor(image)
64356432

64366433
expected = F.to_image(F.rgb_to_grayscale(F.to_pil_image(image), num_output_channels=num_output_channels))
64376434

@@ -6532,11 +6529,7 @@ def test_image_correctness(self, make_input, fn):
65326529
actual = fn(image)
65336530

65346531
if make_input is make_image_cvcuda:
6535-
actual = F.cvcuda_to_tensor(actual).to(device="cpu")
6536-
actual = actual.squeeze(0)
6537-
# drop the batch dimension
6538-
image = F.cvcuda_to_tensor(image).to(device="cpu")
6539-
image = image.squeeze(0)
6532+
image = cvcuda_to_pil_compatible_tensor(image)
65406533

65416534
expected = F.to_image(F.grayscale_to_rgb(F.to_pil_image(image)))
65426535

0 commit comments

Comments
 (0)