Skip to content

Commit d510d4d

Browse files
committed
try unflake CI
1 parent 285500d commit d510d4d

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

test/test_transforms_v2_consistency.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,24 +354,34 @@ def __init__(
354354
v2_transforms.ElasticTransform,
355355
legacy_transforms.ElasticTransform,
356356
[
357-
ArgsKwargs(),
358357
ArgsKwargs(alpha=20.0),
359358
ArgsKwargs(alpha=(15.3, 27.2)),
360359
ArgsKwargs(sigma=3.0),
361360
ArgsKwargs(sigma=(2.5, 3.9)),
362361
ArgsKwargs(interpolation=v2_transforms.InterpolationMode.NEAREST),
363-
ArgsKwargs(interpolation=v2_transforms.InterpolationMode.BICUBIC),
364362
ArgsKwargs(interpolation=PIL.Image.NEAREST),
365-
ArgsKwargs(interpolation=PIL.Image.BICUBIC),
366363
ArgsKwargs(fill=1),
364+
*extra_args_kwargs,
367365
],
368366
# ElasticTransform needs larger images to avoid the needed internal padding being larger than the actual image
369367
make_images_kwargs=dict(DEFAULT_MAKE_IMAGES_KWARGS, sizes=[(163, 163), (72, 333), (313, 95)], dtypes=[dt]),
370368
# We updated gaussian blur kernel generation with a faster and numerically more stable version
371369
# This brings float32 accumulation visible in elastic transform -> we need to relax consistency tolerance
372370
closeness_kwargs=ckw,
373371
)
374-
for dt, ckw in [(torch.uint8, {"rtol": 1e-1, "atol": 1}), (torch.float32, {"rtol": 1e-2, "atol": 1e-3})]
372+
for dt, ckw, extra_args_kwargs in [
373+
(torch.uint8, {"rtol": 1e-1, "atol": 1}, []),
374+
(
375+
torch.float32,
376+
{"rtol": 1e-2, "atol": 1e-3},
377+
[
378+
# These proved to be flaky on uint8 inputs so we only run them on float32
379+
ArgsKwargs(),
380+
ArgsKwargs(interpolation=v2_transforms.InterpolationMode.BICUBIC),
381+
ArgsKwargs(interpolation=PIL.Image.BICUBIC),
382+
],
383+
),
384+
]
375385
],
376386
ConsistencyConfig(
377387
v2_transforms.GaussianBlur,

test/transforms_v2_kernel_infos.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,9 @@ def sample_inputs_affine_video():
635635
sample_inputs_fn=sample_inputs_affine_bounding_box,
636636
reference_fn=reference_affine_bounding_box,
637637
reference_inputs_fn=reference_inputs_affine_bounding_box,
638+
closeness_kwargs={
639+
(("TestKernels", "test_against_reference"), torch.int64, "cpu"): {"atol": 1, "rtol": 0},
640+
},
638641
test_marks=[
639642
xfail_jit_python_scalar_arg("shear"),
640643
],
@@ -1946,13 +1949,15 @@ def sample_inputs_adjust_contrast_video():
19461949
**float32_vs_uint8_pixel_difference(2),
19471950
**cuda_vs_cpu_pixel_difference(),
19481951
(("TestKernels", "test_against_reference"), torch.uint8, "cpu"): pixel_difference_closeness_kwargs(1),
1952+
(("TestKernels", "test_scripted_vs_eager"), torch.uint8, "cuda"): pixel_difference_closeness_kwargs(1),
19491953
},
19501954
),
19511955
KernelInfo(
19521956
F.adjust_contrast_video,
19531957
sample_inputs_fn=sample_inputs_adjust_contrast_video,
19541958
closeness_kwargs={
19551959
**cuda_vs_cpu_pixel_difference(),
1960+
(("TestKernels", "test_scripted_vs_eager"), torch.uint8, "cuda"): pixel_difference_closeness_kwargs(1),
19561961
(("TestKernels", "test_against_reference"), torch.uint8, "cpu"): pixel_difference_closeness_kwargs(1),
19571962
},
19581963
),

0 commit comments

Comments
 (0)