Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 committed Feb 23, 2024
1 parent f995386 commit 1a49b00
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/test_transforms_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ def _check_kernel_compiled_vs_eager(kernel, input, *args, rtol, atol, **kwargs):
actual = kernel_compiled(input, *args, **kwargs)
expected = kernel(input, *args, **kwargs)

print("input:", input.shape, input.dtype, input.stride())
print("actual:", actual.shape, actual.dtype, actual.stride())
print("args, kwargs:", args, kwargs)

assert_close(
actual,
expected,
Expand Down Expand Up @@ -611,6 +615,8 @@ def test_kernel_image(self, size, interpolation, use_max_size, antialias, dtype,
# Internally, it uses the float path. Thus, we need to test with an enormous tolerance here to account for that.
atol = 30 if (interpolation is transforms.InterpolationMode.BICUBIC and dtype is torch.uint8) else 1
check_cuda_vs_cpu_tolerances = dict(rtol=0, atol=atol / 255 if dtype.is_floating_point else atol)
# check_compiled_vs_eager_tolerances = dict(rtol=0, atol=atol / 255 if dtype.is_floating_point else atol)
check_compiled_vs_eager_tolerances = True

check_kernel(
F.resize_image,
Expand All @@ -621,9 +627,7 @@ def test_kernel_image(self, size, interpolation, use_max_size, antialias, dtype,
antialias=antialias,
check_cuda_vs_cpu=check_cuda_vs_cpu_tolerances,
check_scripted_vs_eager=not isinstance(size, int),
check_compiled_vs_eager=dict(rtol=0, atol=1)
if (dtype is torch.uint8 and interpolation == transforms.InterpolationMode.BILINEAR)
else True,
check_compiled_vs_eager=check_compiled_vs_eager_tolerances,
)

@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
Expand Down

0 comments on commit 1a49b00

Please sign in to comment.