Skip to content

Unmute FFT tests that are fixed #2523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 7 additions & 22 deletions dpnp/tests/test_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,7 @@ def test_basic(self, func, dtype, axes):


class TestHfft:
# TODO: include boolean dtype when mkl_fft-gh-180 is merged
@pytest.mark.parametrize(
"dtype", get_all_dtypes(no_none=True, no_bool=True)
)
@pytest.mark.parametrize("dtype", get_all_dtypes(no_none=True))
@pytest.mark.parametrize("n", [None, 5, 18])
@pytest.mark.parametrize("norm", [None, "backward", "forward", "ortho"])
def test_basic(self, dtype, n, norm):
Expand All @@ -563,10 +560,7 @@ def test_basic(self, dtype, n, norm):

result = dpnp.fft.hfft(ia, n=n, norm=norm)
expected = numpy.fft.hfft(a, n=n, norm=norm)
# TODO: change to the commented line when mkl_fft-2.0.0 is released
# and being used with Intel NumPy >= 2.0.0
flag = True
# flag = True if numpy_version() < "2.0.0" else False
flag = True if numpy_version() < "2.0.0" else False
assert_dtype_allclose(
result, expected, factor=24, check_only_type_kind=flag
)
Expand Down Expand Up @@ -609,10 +603,7 @@ def test_basic(self, dtype, n, norm):

result = dpnp.fft.irfft(ia, n=n, norm=norm)
expected = numpy.fft.irfft(a, n=n, norm=norm)
# TODO: change to the commented line when mkl_fft-2.0.0 is released
# and being used with Intel NumPy >= 2.0.0
flag = True
# flag = True if numpy_version() < "2.0.0" else False
flag = True if numpy_version() < "2.0.0" else False
assert_dtype_allclose(
result, expected, factor=24, check_only_type_kind=flag
)
Expand Down Expand Up @@ -779,8 +770,7 @@ def test_float16(self):

expected = numpy.fft.rfft(a)
result = dpnp.fft.rfft(ia)
# TODO: change to the commented line when mkl_fft-2.0.0 is released
# and being used with Intel NumPy >= 2.0.0
# TODO: change to the commented line when mkl_fft-gh-204 is resolved
flag = True
# flag = True if numpy_version() < "2.0.0" else False
assert_dtype_allclose(result, expected, check_only_type_kind=flag)
Expand All @@ -800,11 +790,10 @@ def test_validate_out(self):


class TestRfft2:
# TODO: add other axes when mkl_fft gh-119 is addressed
@pytest.mark.parametrize(
"dtype", get_all_dtypes(no_none=True, no_complex=True)
)
@pytest.mark.parametrize("axes", [(0, 1)]) # (1, 2),(0, 2),(2, 1),(2, 0)
@pytest.mark.parametrize("axes", [(0, 1), (1, 2), (0, 2), (2, 1), (2, 0)])
@pytest.mark.parametrize("norm", [None, "backward", "forward", "ortho"])
@pytest.mark.parametrize("order", ["C", "F"])
def test_basic(self, dtype, axes, norm, order):
Expand Down Expand Up @@ -859,12 +848,11 @@ def test_error(self, xp):


class TestRfftn:
# TODO: add additional axes when mkl_fft gh-119 is addressed
@pytest.mark.parametrize(
"dtype", get_all_dtypes(no_none=True, no_complex=True)
)
@pytest.mark.parametrize(
"axes", [(0, 1, 2), (-2, -4, -1, -3)] # (-1, -4, -2)
"axes", [(0, 1, 2), (-2, -4, -1, -3), (-1, -4, -2)]
)
@pytest.mark.parametrize("norm", [None, "backward", "forward", "ortho"])
@pytest.mark.parametrize("order", ["C", "F"])
Expand Down Expand Up @@ -965,8 +953,5 @@ def test_1d_array(self):

result = dpnp.fft.irfftn(ia)
expected = numpy.fft.irfftn(a)
# TODO: change to the commented line when mkl_fft-2.0.0 is released
# and being used with Intel NumPy >= 2.0.0
flag = True
# flag = True if numpy_version() < "2.0.0" else False
flag = True if numpy_version() < "2.0.0" else False
assert_dtype_allclose(result, expected, check_only_type_kind=flag)
64 changes: 30 additions & 34 deletions dpnp/tests/third_party/cupy/fft_tests/test_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,21 +378,21 @@ def test_fft_allocate(self):
{"shape": (3, 4), "s": (1, 5), "axes": (-2, -1)},
{"shape": (3, 4), "s": None, "axes": (-2, -1)},
{"shape": (3, 4), "s": None, "axes": (-1, -2)},
# {"shape": (3, 4), "s": None, "axes": (0,)}, # mkl_fft gh-109
{"shape": (3, 4), "s": None, "axes": (0,)},
{"shape": (3, 4), "s": None, "axes": None},
# {"shape": (3, 4), "s": None, "axes": ()}, # mkl_fft gh-108
{"shape": (3, 4), "s": None, "axes": ()},
{"shape": (2, 3, 4), "s": None, "axes": None},
{"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-2, -1)},
{"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)},
{"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)},
# {"shape": (2, 3, 4), "s": None, "axes": (0, 1)}, # mkl_fft gh-109
{"shape": (2, 3, 4), "s": None, "axes": (0, 1)},
{"shape": (2, 3, 4), "s": None, "axes": None},
# {"shape": (2, 3, 4), "s": None, "axes": ()}, # mkl_fft gh-108
# {"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)}, # mkl_fft gh-109
{"shape": (2, 3, 4), "s": None, "axes": ()},
{"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)},
{"shape": (2, 3, 4, 5), "s": None, "axes": None},
# {"shape": (0, 5), "s": None, "axes": None}, # mkl_fft gh-110
# {"shape": (2, 0, 5), "s": None, "axes": None}, # mkl_fft gh-110
# {"shape": (0, 0, 5), "s": None, "axes": None}, # mkl_fft gh-110
{"shape": (0, 5), "s": None, "axes": None},
{"shape": (2, 0, 5), "s": None, "axes": None},
{"shape": (0, 0, 5), "s": None, "axes": None},
{"shape": (3, 4), "s": (0, 5), "axes": (-2, -1)},
{"shape": (3, 4), "s": (1, 0), "axes": (-2, -1)},
],
Expand Down Expand Up @@ -468,23 +468,23 @@ def test_ifft2(self, xp, dtype, order, enable_nd):
{"shape": (3, 4), "s": None, "axes": (-2, -1)},
{"shape": (3, 4), "s": None, "axes": (-1, -2)},
{"shape": (3, 4), "s": None, "axes": [-1, -2]},
# {"shape": (3, 4), "s": None, "axes": (0,)}, # mkl_fft gh-109
# {"shape": (3, 4), "s": None, "axes": ()}, # mkl_fft gh-108
{"shape": (3, 4), "s": None, "axes": (0,)},
{"shape": (3, 4), "s": None, "axes": ()},
{"shape": (3, 4), "s": None, "axes": None},
{"shape": (2, 3, 4), "s": None, "axes": None},
{"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-3, -2, -1)},
{"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)},
{"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)},
# {"shape": (2, 3, 4), "s": None, "axes": (-1, -3)}, # mkl_fft gh-109
# {"shape": (2, 3, 4), "s": None, "axes": (0, 1)}, # mkl_fft gh-109
{"shape": (2, 3, 4), "s": None, "axes": (-1, -3)},
{"shape": (2, 3, 4), "s": None, "axes": (0, 1)},
{"shape": (2, 3, 4), "s": None, "axes": None},
# {"shape": (2, 3, 4), "s": None, "axes": ()}, # mkl_fft gh-108
# {"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)}, # mkl_fft gh-109
{"shape": (2, 3, 4), "s": None, "axes": ()},
{"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)},
{"shape": (2, 3, 4), "s": (4, 3, 2), "axes": (2, 0, 1)},
{"shape": (2, 3, 4, 5), "s": None, "axes": None},
# {"shape": (0, 5), "s": None, "axes": None}, # mkl_fft gh-110
# {"shape": (2, 0, 5), "s": None, "axes": None}, # mkl_fft gh-110
# {"shape": (0, 0, 5), "s": None, "axes": None}, # mkl_fft gh-110
{"shape": (0, 5), "s": None, "axes": None},
{"shape": (2, 0, 5), "s": None, "axes": None},
{"shape": (0, 0, 5), "s": None, "axes": None},
],
testing.product({"norm": [None, "backward", "ortho", "forward"]}),
)
Expand Down Expand Up @@ -912,8 +912,7 @@ def test_rfft(self, xp, dtype):
atol=2e-6,
accept_error=ValueError,
contiguous_check=False,
# TODO: replace with has_support_aspect64() when mkl_fft-gh-180 is merged
type_check=False,
type_check=has_support_aspect64(),
)
def test_irfft(self, xp, dtype):
a = testing.shaped_random(self.shape, xp, dtype)
Expand Down Expand Up @@ -1002,14 +1001,14 @@ def test_rfft_error_on_wrong_plan(self, dtype):
{"shape": (3, 4), "s": None, "axes": (-1, -2)},
{"shape": (3, 4), "s": None, "axes": (0,)},
{"shape": (3, 4), "s": None, "axes": None},
# {"shape": (2, 3, 4), "s": None, "axes": None}, # mkl_fft gh-116
# {"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-3, -2, -1)}, # mkl_fft gh-115
# {"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)}, # mkl_fft gh-116
# {"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)}, # mkl_fft gh-116
{"shape": (2, 3, 4), "s": None, "axes": None},
{"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-3, -2, -1)},
{"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)},
{"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)},
{"shape": (2, 3, 4), "s": None, "axes": (0, 1)},
{"shape": (2, 3, 4), "s": None, "axes": None},
{"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)},
# {"shape": (2, 3, 4, 5), "s": None, "axes": None}, # mkl_fft gh-109 and gh-116
{"shape": (2, 3, 4, 5), "s": None, "axes": None},
],
testing.product(
{"norm": [None, "backward", "ortho", "forward", ""]}
Expand Down Expand Up @@ -1044,8 +1043,7 @@ def test_rfft2(self, xp, dtype, order, enable_nd):
atol=1e-7,
accept_error=ValueError,
contiguous_check=False,
# TODO: replace with has_support_aspect64() when mkl_fft-gh-180 is merged
type_check=False,
type_check=has_support_aspect64(),
)
def test_irfft2(self, xp, dtype, order, enable_nd):
# assert config.enable_nd_planning == enable_nd
Expand Down Expand Up @@ -1090,13 +1088,13 @@ def test_irfft2(self, dtype):
{"shape": (3, 4), "s": None, "axes": (0,)},
{"shape": (3, 4), "s": None, "axes": None},
{"shape": (2, 3, 4), "s": None, "axes": None},
# {"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-3, -2, -1)}, # mkl_fft gh-115
# {"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)}, # mkl_fft gh-116
# {"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)}, # mkl_fft gh-116
{"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-3, -2, -1)},
{"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)},
{"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)},
{"shape": (2, 3, 4), "s": None, "axes": (0, 1)},
{"shape": (2, 3, 4), "s": None, "axes": None},
{"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)},
# {"shape": (2, 3, 4, 5), "s": None, "axes": None}, # mkl_fft gh-109 and gh-116
{"shape": (2, 3, 4, 5), "s": None, "axes": None},
],
testing.product(
{"norm": [None, "backward", "ortho", "forward", ""]}
Expand Down Expand Up @@ -1131,8 +1129,7 @@ def test_rfftn(self, xp, dtype, order, enable_nd):
atol=1e-7,
accept_error=ValueError,
contiguous_check=False,
# TODO: replace with has_support_aspect64() when mkl_fft-gh-180 is merged
type_check=False,
type_check=has_support_aspect64(),
)
def test_irfftn(self, xp, dtype, order, enable_nd):
# assert config.enable_nd_planning == enable_nd
Expand Down Expand Up @@ -1326,8 +1323,7 @@ class TestHfft:
atol=2e-6,
accept_error=ValueError,
contiguous_check=False,
# TODO: replace with has_support_aspect64() when mkl_fft-gh-180 is merged
type_check=False,
type_check=has_support_aspect64(),
)
def test_hfft(self, xp, dtype):
a = testing.shaped_random(self.shape, xp, dtype)
Expand Down
Loading