@@ -4748,7 +4748,7 @@ def test_functional(self, make_input):
47484748 (F .pad_mask , tv_tensors .Mask ),
47494749 (F .pad_video , tv_tensors .Video ),
47504750 pytest .param (
4751- F .pad_image_cvcuda ,
4751+ F ._geometry . _pad_cvcuda ,
47524752 "cvcuda.Tensor" ,
47534753 marks = pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "test requires CVCUDA" ),
47544754 ),
@@ -4813,6 +4813,26 @@ def test_image_correctness(self, padding, padding_mode, fill, fn):
48134813
48144814 assert_equal (actual , expected )
48154815
4816+ @pytest .mark .skipif (not CVCUDA_AVAILABLE , reason = "test requires CVCUDA" )
4817+ @pytest .mark .parametrize ("padding" , CORRECTNESS_PADDINGS )
4818+ @pytest .mark .parametrize (
4819+ ("padding_mode" , "fill" ),
4820+ [
4821+ * [("constant" , fill ) for fill in CORRECTNESS_FILLS ],
4822+ * [(padding_mode , None ) for padding_mode in ["symmetric" , "edge" , "reflect" ]],
4823+ ],
4824+ )
4825+ @pytest .mark .parametrize ("fn" , [F .pad , transform_cls_to_functional (transforms .Pad )])
4826+ def test_cvcuda_correctness (self , padding , padding_mode , fill , fn ):
4827+ image = make_image_cvcuda (dtype = torch .uint8 , device = "cuda" )
4828+
4829+ fill = adapt_fill (fill , dtype = torch .uint8 )
4830+
4831+ actual = fn (image , padding = padding , padding_mode = padding_mode , fill = fill )
4832+ expected = F .pad (F .cvcuda_to_tensor (image ), padding = padding , padding_mode = padding_mode , fill = fill )
4833+
4834+ assert_equal (F .cvcuda_to_tensor (actual ), expected )
4835+
48164836 def _reference_pad_bounding_boxes (self , bounding_boxes , * , padding ):
48174837 if isinstance (padding , int ):
48184838 padding = [padding ]
0 commit comments