@@ -67,6 +67,7 @@ def test_scale_channel():
6767
6868
6969class TestRotate :
70+
7071 ALL_DTYPES = [None , torch .float32 , torch .float64 , torch .float16 ]
7172 scripted_rotate = torch .jit .script (F .rotate )
7273 IMG_W = 26
@@ -152,6 +153,7 @@ def test_rotate_interpolation_type(self):
152153
153154
154155class TestAffine :
156+
155157 ALL_DTYPES = [None , torch .float32 , torch .float64 , torch .float16 ]
156158 scripted_affine = torch .jit .script (F .affine )
157159
@@ -405,6 +407,7 @@ def _get_data_dims_and_points_for_perspective():
405407)
406408@pytest .mark .parametrize ("fn" , [F .perspective , torch .jit .script (F .perspective )])
407409def test_perspective_pil_vs_tensor (device , dims_and_points , dt , fill , fn ):
410+
408411 if dt == torch .float16 and device == "cpu" :
409412 # skip float16 on CPU case
410413 return
@@ -436,6 +439,7 @@ def test_perspective_pil_vs_tensor(device, dims_and_points, dt, fill, fn):
436439@pytest .mark .parametrize ("dims_and_points" , _get_data_dims_and_points_for_perspective ())
437440@pytest .mark .parametrize ("dt" , [None , torch .float32 , torch .float64 , torch .float16 ])
438441def test_perspective_batch (device , dims_and_points , dt ):
442+
439443 if dt == torch .float16 and device == "cpu" :
440444 # skip float16 on CPU case
441445 return
@@ -487,6 +491,7 @@ def test_perspective_interpolation_type():
487491@pytest .mark .parametrize ("max_size" , [None , 34 , 40 , 1000 ])
488492@pytest .mark .parametrize ("interpolation" , [BILINEAR , BICUBIC , NEAREST , NEAREST_EXACT ])
489493def test_resize (device , dt , size , max_size , interpolation ):
494+
490495 if dt == torch .float16 and device == "cpu" :
491496 # skip float16 on CPU case
492497 return
@@ -536,6 +541,7 @@ def test_resize(device, dt, size, max_size, interpolation):
536541
537542@pytest .mark .parametrize ("device" , cpu_and_gpu ())
538543def test_resize_asserts (device ):
544+
539545 tensor , pil_img = _create_data (26 , 36 , device = device )
540546
541547 res1 = F .resize (tensor , size = 32 , interpolation = PIL .Image .BILINEAR )
@@ -555,6 +561,7 @@ def test_resize_asserts(device):
555561@pytest .mark .parametrize ("size" , [[96 , 72 ], [96 , 420 ], [420 , 72 ]])
556562@pytest .mark .parametrize ("interpolation" , [BILINEAR , BICUBIC ])
557563def test_resize_antialias (device , dt , size , interpolation ):
564+
558565 if dt == torch .float16 and device == "cpu" :
559566 # skip float16 on CPU case
560567 return
@@ -603,6 +610,7 @@ def test_resize_antialias(device, dt, size, interpolation):
603610
604611
605612def test_resize_antialias_default_warning ():
613+
606614 img = torch .randint (0 , 256 , size = (3 , 44 , 56 ), dtype = torch .uint8 )
607615
608616 match = "The default value of the antialias"
@@ -621,6 +629,7 @@ def test_resize_antialias_default_warning():
621629def check_functional_vs_PIL_vs_scripted (
622630 fn , fn_pil , fn_t , config , device , dtype , channels = 3 , tol = 2.0 + 1e-10 , agg_method = "max"
623631):
632+
624633 script_fn = torch .jit .script (fn )
625634 torch .manual_seed (15 )
626635 tensor , pil_img = _create_data (26 , 34 , channels = channels , device = device )
@@ -1057,6 +1066,7 @@ def test_crop(device, top, left, height, width):
10571066@pytest .mark .parametrize ("sigma" , [[0.5 , 0.5 ], (0.5 , 0.5 ), (0.8 , 0.8 ), (1.7 , 1.7 )])
10581067@pytest .mark .parametrize ("fn" , [F .gaussian_blur , torch .jit .script (F .gaussian_blur )])
10591068def test_gaussian_blur (device , image_size , dt , ksize , sigma , fn ):
1069+
10601070 # true_cv2_results = {
10611071 # # np_img = np.arange(3 * 10 * 12, dtype="uint8").reshape((10, 12, 3))
10621072 # # cv2.GaussianBlur(np_img, ksize=(3, 3), sigmaX=0.8)
0 commit comments