diff --git a/test/test_transforms_v2_consistency.py b/test/test_transforms_v2_consistency.py index 05ab6b67af5..443ee8f09b3 100644 --- a/test/test_transforms_v2_consistency.py +++ b/test/test_transforms_v2_consistency.py @@ -354,16 +354,14 @@ def __init__( v2_transforms.ElasticTransform, legacy_transforms.ElasticTransform, [ - ArgsKwargs(), ArgsKwargs(alpha=20.0), ArgsKwargs(alpha=(15.3, 27.2)), ArgsKwargs(sigma=3.0), ArgsKwargs(sigma=(2.5, 3.9)), ArgsKwargs(interpolation=v2_transforms.InterpolationMode.NEAREST), - ArgsKwargs(interpolation=v2_transforms.InterpolationMode.BICUBIC), ArgsKwargs(interpolation=PIL.Image.NEAREST), - ArgsKwargs(interpolation=PIL.Image.BICUBIC), ArgsKwargs(fill=1), + *extra_args_kwargs, ], # ElasticTransform needs larger images to avoid the needed internal padding being larger than the actual image make_images_kwargs=dict(DEFAULT_MAKE_IMAGES_KWARGS, sizes=[(163, 163), (72, 333), (313, 95)], dtypes=[dt]), @@ -371,7 +369,19 @@ def __init__( # This brings float32 accumulation visible in elastic transform -> we need to relax consistency tolerance closeness_kwargs=ckw, ) - for dt, ckw in [(torch.uint8, {"rtol": 1e-1, "atol": 1}), (torch.float32, {"rtol": 1e-2, "atol": 1e-3})] + for dt, ckw, extra_args_kwargs in [ + (torch.uint8, {"rtol": 1e-1, "atol": 1}, []), + ( + torch.float32, + {"rtol": 1e-2, "atol": 1e-3}, + [ + # These proved to be flaky on uint8 inputs so we only run them on float32 + ArgsKwargs(), + ArgsKwargs(interpolation=v2_transforms.InterpolationMode.BICUBIC), + ArgsKwargs(interpolation=PIL.Image.BICUBIC), + ], + ), + ] ], ConsistencyConfig( v2_transforms.GaussianBlur, diff --git a/test/transforms_v2_kernel_infos.py b/test/transforms_v2_kernel_infos.py index e5873f80d15..453b8ece9d8 100644 --- a/test/transforms_v2_kernel_infos.py +++ b/test/transforms_v2_kernel_infos.py @@ -635,6 +635,9 @@ def sample_inputs_affine_video(): sample_inputs_fn=sample_inputs_affine_bounding_box, reference_fn=reference_affine_bounding_box, reference_inputs_fn=reference_inputs_affine_bounding_box, + closeness_kwargs={ + (("TestKernels", "test_against_reference"), torch.int64, "cpu"): {"atol": 1, "rtol": 0}, + }, test_marks=[ xfail_jit_python_scalar_arg("shear"), ], @@ -1946,6 +1949,7 @@ def sample_inputs_adjust_contrast_video(): **float32_vs_uint8_pixel_difference(2), **cuda_vs_cpu_pixel_difference(), (("TestKernels", "test_against_reference"), torch.uint8, "cpu"): pixel_difference_closeness_kwargs(1), + (("TestKernels", "test_scripted_vs_eager"), torch.uint8, "cuda"): pixel_difference_closeness_kwargs(1), }, ), KernelInfo( @@ -1953,6 +1957,7 @@ def sample_inputs_adjust_contrast_video(): sample_inputs_fn=sample_inputs_adjust_contrast_video, closeness_kwargs={ **cuda_vs_cpu_pixel_difference(), + (("TestKernels", "test_scripted_vs_eager"), torch.uint8, "cuda"): pixel_difference_closeness_kwargs(1), (("TestKernels", "test_against_reference"), torch.uint8, "cpu"): pixel_difference_closeness_kwargs(1), }, ),