@@ -1240,10 +1240,6 @@ def test_kernel_video(self):
12401240 make_image_tensor ,
12411241 make_image_pil ,
12421242 make_image ,
1243- pytest .param (
1244- make_image_cvcuda ,
1245- marks = pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "CVCUDA is not available" ),
1246- ),
12471243 make_bounding_boxes ,
12481244 make_segmentation_mask ,
12491245 make_video ,
@@ -1259,20 +1255,13 @@ def test_functional(self, make_input):
12591255 (F .horizontal_flip_image , torch .Tensor ),
12601256 (F ._geometry ._horizontal_flip_image_pil , PIL .Image .Image ),
12611257 (F .horizontal_flip_image , tv_tensors .Image ),
1262- pytest .param (
1263- F ._geometry ._horizontal_flip_image_cvcuda ,
1264- None ,
1265- marks = pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "CVCUDA is not available" ),
1266- ),
12671258 (F .horizontal_flip_bounding_boxes , tv_tensors .BoundingBoxes ),
12681259 (F .horizontal_flip_mask , tv_tensors .Mask ),
12691260 (F .horizontal_flip_video , tv_tensors .Video ),
12701261 (F .horizontal_flip_keypoints , tv_tensors .KeyPoints ),
12711262 ],
12721263 )
12731264 def test_functional_signature (self , kernel , input_type ):
1274- if kernel is F ._geometry ._horizontal_flip_image_cvcuda :
1275- input_type = _import_cvcuda ().Tensor
12761265 check_functional_kernel_signature_match (F .horizontal_flip , kernel = kernel , input_type = input_type )
12771266
12781267 @pytest .mark .parametrize (
@@ -1281,10 +1270,6 @@ def test_functional_signature(self, kernel, input_type):
12811270 make_image_tensor ,
12821271 make_image_pil ,
12831272 make_image ,
1284- pytest .param (
1285- make_image_cvcuda ,
1286- marks = pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "CVCUDA is not available" ),
1287- ),
12881273 make_bounding_boxes ,
12891274 make_segmentation_mask ,
12901275 make_video ,
@@ -1298,23 +1283,13 @@ def test_transform(self, make_input, device):
12981283 @pytest .mark .parametrize (
12991284 "fn" , [F .horizontal_flip , transform_cls_to_functional (transforms .RandomHorizontalFlip , p = 1 )]
13001285 )
1301- @pytest .mark .parametrize (
1302- "make_input" ,
1303- [
1304- make_image ,
1305- pytest .param (
1306- make_image_cvcuda ,
1307- marks = pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "CVCUDA is not available" ),
1308- ),
1309- ],
1310- )
1311- def test_image_correctness (self , fn , make_input ):
1312- image = make_input ()
1286+ def test_image_correctness (self , fn ):
1287+ image = make_image (dtype = torch .uint8 , device = "cpu" )
1288+
13131289 actual = fn (image )
1314- if make_input is make_image_cvcuda :
1315- image = F .cvcuda_to_tensor (image )[0 ].cpu ()
1316- expected = F .horizontal_flip (F .to_pil_image (image ))
1317- assert_equal (actual , expected )
1290+ expected = F .to_image (F .horizontal_flip (F .to_pil_image (image )))
1291+
1292+ torch .testing .assert_close (actual , expected )
13181293
13191294 def _reference_horizontal_flip_bounding_boxes (self , bounding_boxes : tv_tensors .BoundingBoxes ):
13201295 affine_matrix = np .array (
@@ -1370,10 +1345,6 @@ def test_keypoints_correctness(self, fn):
13701345 make_image_tensor ,
13711346 make_image_pil ,
13721347 make_image ,
1373- pytest .param (
1374- make_image_cvcuda ,
1375- marks = pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "CVCUDA is not available" ),
1376- ),
13771348 make_bounding_boxes ,
13781349 make_segmentation_mask ,
13791350 make_video ,
@@ -1383,8 +1354,11 @@ def test_keypoints_correctness(self, fn):
13831354 @pytest .mark .parametrize ("device" , cpu_and_cuda ())
13841355 def test_transform_noop (self , make_input , device ):
13851356 input = make_input (device = device )
1357+
13861358 transform = transforms .RandomHorizontalFlip (p = 0 )
1359+
13871360 output = transform (input )
1361+
13881362 assert_equal (output , input )
13891363
13901364
@@ -1882,10 +1856,6 @@ def test_kernel_video(self):
18821856 make_image_tensor ,
18831857 make_image_pil ,
18841858 make_image ,
1885- pytest .param (
1886- make_image_cvcuda ,
1887- marks = pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "CVCUDA is not available" ),
1888- ),
18891859 make_bounding_boxes ,
18901860 make_segmentation_mask ,
18911861 make_video ,
@@ -1901,20 +1871,13 @@ def test_functional(self, make_input):
19011871 (F .vertical_flip_image , torch .Tensor ),
19021872 (F ._geometry ._vertical_flip_image_pil , PIL .Image .Image ),
19031873 (F .vertical_flip_image , tv_tensors .Image ),
1904- pytest .param (
1905- F ._geometry ._vertical_flip_image_cvcuda ,
1906- None ,
1907- marks = pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "CVCUDA is not available" ),
1908- ),
19091874 (F .vertical_flip_bounding_boxes , tv_tensors .BoundingBoxes ),
19101875 (F .vertical_flip_mask , tv_tensors .Mask ),
19111876 (F .vertical_flip_video , tv_tensors .Video ),
19121877 (F .vertical_flip_keypoints , tv_tensors .KeyPoints ),
19131878 ],
19141879 )
19151880 def test_functional_signature (self , kernel , input_type ):
1916- if kernel is F ._geometry ._vertical_flip_image_cvcuda :
1917- input_type = _import_cvcuda ().Tensor
19181881 check_functional_kernel_signature_match (F .vertical_flip , kernel = kernel , input_type = input_type )
19191882
19201883 @pytest .mark .parametrize (
@@ -1923,10 +1886,6 @@ def test_functional_signature(self, kernel, input_type):
19231886 make_image_tensor ,
19241887 make_image_pil ,
19251888 make_image ,
1926- pytest .param (
1927- make_image_cvcuda ,
1928- marks = pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "CVCUDA is not available" ),
1929- ),
19301889 make_bounding_boxes ,
19311890 make_segmentation_mask ,
19321891 make_video ,
@@ -1938,23 +1897,13 @@ def test_transform(self, make_input, device):
19381897 check_transform (transforms .RandomVerticalFlip (p = 1 ), make_input (device = device ))
19391898
19401899 @pytest .mark .parametrize ("fn" , [F .vertical_flip , transform_cls_to_functional (transforms .RandomVerticalFlip , p = 1 )])
1941- @pytest .mark .parametrize (
1942- "make_input" ,
1943- [
1944- make_image ,
1945- pytest .param (
1946- make_image_cvcuda ,
1947- marks = pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "CVCUDA is not available" ),
1948- ),
1949- ],
1950- )
1951- def test_image_correctness (self , fn , make_input ):
1952- image = make_input ()
1900+ def test_image_correctness (self , fn ):
1901+ image = make_image (dtype = torch .uint8 , device = "cpu" )
1902+
19531903 actual = fn (image )
1954- if make_input is make_image_cvcuda :
1955- image = F .cvcuda_to_tensor (image )[0 ].cpu ()
1956- expected = F .vertical_flip (F .to_pil_image (image ))
1957- assert_equal (actual , expected )
1904+ expected = F .to_image (F .vertical_flip (F .to_pil_image (image )))
1905+
1906+ torch .testing .assert_close (actual , expected )
19581907
19591908 def _reference_vertical_flip_bounding_boxes (self , bounding_boxes : tv_tensors .BoundingBoxes ):
19601909 affine_matrix = np .array (
@@ -2006,10 +1955,6 @@ def test_keypoints_correctness(self, fn):
20061955 make_image_tensor ,
20071956 make_image_pil ,
20081957 make_image ,
2009- pytest .param (
2010- make_image_cvcuda ,
2011- marks = pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "CVCUDA is not available" ),
2012- ),
20131958 make_bounding_boxes ,
20141959 make_segmentation_mask ,
20151960 make_video ,
@@ -2019,8 +1964,11 @@ def test_keypoints_correctness(self, fn):
20191964 @pytest .mark .parametrize ("device" , cpu_and_cuda ())
20201965 def test_transform_noop (self , make_input , device ):
20211966 input = make_input (device = device )
1967+
20221968 transform = transforms .RandomVerticalFlip (p = 0 )
1969+
20231970 output = transform (input )
1971+
20241972 assert_equal (output , input )
20251973
20261974
0 commit comments