From b7233e3c8685a5edd56457e0445992a9472524c2 Mon Sep 17 00:00:00 2001 From: Michael Eickenberg Date: Thu, 12 Oct 2023 16:29:10 -0400 Subject: [PATCH] FIX address PR comments for tests --- tests/test_1d/test_backward_1d.py | 20 +++++++++++++++++++- tests/test_2d/test_backward_2d.py | 18 ++++++++++++++++++ tests/test_3d/test_backward_3d.py | 18 ++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/tests/test_1d/test_backward_1d.py b/tests/test_1d/test_backward_1d.py index 271c353..fefc70f 100644 --- a/tests/test_1d/test_backward_1d.py +++ b/tests/test_1d/test_backward_1d.py @@ -187,7 +187,7 @@ def func(points, targets): dict(modeord=int(not fftshift), isign=isign), ) - assert gradcheck(func, inputs, atol=1.5e-4 * N) + assert gradcheck(func, inputs, atol=5e-3 * N) @pytest.mark.parametrize("N", Ns) @@ -208,3 +208,21 @@ def test_t2_backward_CPU_points( ) -> None: check_t2_backward(N, modifier, fftshift, isign, "cpu", True) +@pytest.mark.parametrize("N", Ns) +@pytest.mark.parametrize("modifier", length_modifiers) +@pytest.mark.parametrize("fftshift", [False, True]) +@pytest.mark.parametrize("isign", [-1, 1]) +def test_t2_backward_CPU_values( + N: int, modifier: int, fftshift: bool, isign: int +) -> None: + check_t2_backward(N, modifier, fftshift, isign, "cuda", False) + +@pytest.mark.parametrize("N", Ns) +@pytest.mark.parametrize("modifier", length_modifiers) +@pytest.mark.parametrize("fftshift", [False, True]) +@pytest.mark.parametrize("isign", [-1, 1]) +def test_t2_backward_CPU_points( + N: int, modifier: int, fftshift: bool, isign: int +) -> None: + check_t2_backward(N, modifier, fftshift, isign, "cuda", True) + diff --git a/tests/test_2d/test_backward_2d.py b/tests/test_2d/test_backward_2d.py index 7d67dce..7650769 100644 --- a/tests/test_2d/test_backward_2d.py +++ b/tests/test_2d/test_backward_2d.py @@ -250,3 +250,21 @@ def test_t2_backward_CPU_points( ) -> None: check_t2_backward(N, modifier, fftshift, isign, "cpu", True) +@pytest.mark.parametrize("N", Ns) +@pytest.mark.parametrize("modifier", length_modifiers) +@pytest.mark.parametrize("fftshift", [False, True]) +@pytest.mark.parametrize("isign", [-1, 1]) +def test_t2_backward_CPU_values( + N: int, modifier: int, fftshift: bool, isign: int +) -> None: + check_t2_backward(N, modifier, fftshift, isign, "cuda", False) + +@pytest.mark.parametrize("N", Ns) +@pytest.mark.parametrize("modifier", length_modifiers) +@pytest.mark.parametrize("fftshift", [False, True]) +@pytest.mark.parametrize("isign", [-1, 1]) +def test_t2_backward_CPU_points( + N: int, modifier: int, fftshift: bool, isign: int +) -> None: + check_t2_backward(N, modifier, fftshift, isign, "cuda", True) + diff --git a/tests/test_3d/test_backward_3d.py b/tests/test_3d/test_backward_3d.py index 50fa9b6..5377c25 100644 --- a/tests/test_3d/test_backward_3d.py +++ b/tests/test_3d/test_backward_3d.py @@ -288,3 +288,21 @@ def test_t2_backward_CPU_points( ) -> None: check_t2_backward(N, modifier, fftshift, isign, "cpu", True) +@pytest.mark.parametrize("N", Ns) +@pytest.mark.parametrize("modifier", length_modifiers) +@pytest.mark.parametrize("fftshift", [False, True]) +@pytest.mark.parametrize("isign", [-1, 1]) +def test_t2_backward_CPU_values( + N: int, modifier: int, fftshift: bool, isign: int +) -> None: + check_t2_backward(N, modifier, fftshift, isign, "cuda", False) + +@pytest.mark.parametrize("N", Ns) +@pytest.mark.parametrize("modifier", length_modifiers) +@pytest.mark.parametrize("fftshift", [False, True]) +@pytest.mark.parametrize("isign", [-1, 1]) +def test_t2_backward_CPU_points( + N: int, modifier: int, fftshift: bool, isign: int +) -> None: + check_t2_backward(N, modifier, fftshift, isign, "cuda", True) +