Skip to content

Commit 81083de

Browse files
authored
Merge branch 'master' into blas-backend
2 parents 6fd193c + 425ec0c commit 81083de

File tree

2 files changed

+37
-56
lines changed

2 files changed

+37
-56
lines changed

dpnp/tests/test_fft.py

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,7 @@ def test_basic(self, func, dtype, axes):
551551

552552

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

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

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

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

801791

802792
class TestRfft2:
803-
# TODO: add other axes when mkl_fft gh-119 is addressed
804793
@pytest.mark.parametrize(
805794
"dtype", get_all_dtypes(no_none=True, no_complex=True)
806795
)
807-
@pytest.mark.parametrize("axes", [(0, 1)]) # (1, 2),(0, 2),(2, 1),(2, 0)
796+
@pytest.mark.parametrize("axes", [(0, 1), (1, 2), (0, 2), (2, 1), (2, 0)])
808797
@pytest.mark.parametrize("norm", [None, "backward", "forward", "ortho"])
809798
@pytest.mark.parametrize("order", ["C", "F"])
810799
def test_basic(self, dtype, axes, norm, order):
@@ -859,12 +848,11 @@ def test_error(self, xp):
859848

860849

861850
class TestRfftn:
862-
# TODO: add additional axes when mkl_fft gh-119 is addressed
863851
@pytest.mark.parametrize(
864852
"dtype", get_all_dtypes(no_none=True, no_complex=True)
865853
)
866854
@pytest.mark.parametrize(
867-
"axes", [(0, 1, 2), (-2, -4, -1, -3)] # (-1, -4, -2)
855+
"axes", [(0, 1, 2), (-2, -4, -1, -3), (-1, -4, -2)]
868856
)
869857
@pytest.mark.parametrize("norm", [None, "backward", "forward", "ortho"])
870858
@pytest.mark.parametrize("order", ["C", "F"])
@@ -965,8 +953,5 @@ def test_1d_array(self):
965953

966954
result = dpnp.fft.irfftn(ia)
967955
expected = numpy.fft.irfftn(a)
968-
# TODO: change to the commented line when mkl_fft-2.0.0 is released
969-
# and being used with Intel NumPy >= 2.0.0
970-
flag = True
971-
# flag = True if numpy_version() < "2.0.0" else False
956+
flag = True if numpy_version() < "2.0.0" else False
972957
assert_dtype_allclose(result, expected, check_only_type_kind=flag)

dpnp/tests/third_party/cupy/fft_tests/test_fft.py

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -378,21 +378,21 @@ def test_fft_allocate(self):
378378
{"shape": (3, 4), "s": (1, 5), "axes": (-2, -1)},
379379
{"shape": (3, 4), "s": None, "axes": (-2, -1)},
380380
{"shape": (3, 4), "s": None, "axes": (-1, -2)},
381-
# {"shape": (3, 4), "s": None, "axes": (0,)}, # mkl_fft gh-109
381+
{"shape": (3, 4), "s": None, "axes": (0,)},
382382
{"shape": (3, 4), "s": None, "axes": None},
383-
# {"shape": (3, 4), "s": None, "axes": ()}, # mkl_fft gh-108
383+
{"shape": (3, 4), "s": None, "axes": ()},
384384
{"shape": (2, 3, 4), "s": None, "axes": None},
385385
{"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-2, -1)},
386386
{"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)},
387387
{"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)},
388-
# {"shape": (2, 3, 4), "s": None, "axes": (0, 1)}, # mkl_fft gh-109
388+
{"shape": (2, 3, 4), "s": None, "axes": (0, 1)},
389389
{"shape": (2, 3, 4), "s": None, "axes": None},
390-
# {"shape": (2, 3, 4), "s": None, "axes": ()}, # mkl_fft gh-108
391-
# {"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)}, # mkl_fft gh-109
390+
{"shape": (2, 3, 4), "s": None, "axes": ()},
391+
{"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)},
392392
{"shape": (2, 3, 4, 5), "s": None, "axes": None},
393-
# {"shape": (0, 5), "s": None, "axes": None}, # mkl_fft gh-110
394-
# {"shape": (2, 0, 5), "s": None, "axes": None}, # mkl_fft gh-110
395-
# {"shape": (0, 0, 5), "s": None, "axes": None}, # mkl_fft gh-110
393+
{"shape": (0, 5), "s": None, "axes": None},
394+
{"shape": (2, 0, 5), "s": None, "axes": None},
395+
{"shape": (0, 0, 5), "s": None, "axes": None},
396396
{"shape": (3, 4), "s": (0, 5), "axes": (-2, -1)},
397397
{"shape": (3, 4), "s": (1, 0), "axes": (-2, -1)},
398398
],
@@ -468,23 +468,23 @@ def test_ifft2(self, xp, dtype, order, enable_nd):
468468
{"shape": (3, 4), "s": None, "axes": (-2, -1)},
469469
{"shape": (3, 4), "s": None, "axes": (-1, -2)},
470470
{"shape": (3, 4), "s": None, "axes": [-1, -2]},
471-
# {"shape": (3, 4), "s": None, "axes": (0,)}, # mkl_fft gh-109
472-
# {"shape": (3, 4), "s": None, "axes": ()}, # mkl_fft gh-108
471+
{"shape": (3, 4), "s": None, "axes": (0,)},
472+
{"shape": (3, 4), "s": None, "axes": ()},
473473
{"shape": (3, 4), "s": None, "axes": None},
474474
{"shape": (2, 3, 4), "s": None, "axes": None},
475475
{"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-3, -2, -1)},
476476
{"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)},
477477
{"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)},
478-
# {"shape": (2, 3, 4), "s": None, "axes": (-1, -3)}, # mkl_fft gh-109
479-
# {"shape": (2, 3, 4), "s": None, "axes": (0, 1)}, # mkl_fft gh-109
478+
{"shape": (2, 3, 4), "s": None, "axes": (-1, -3)},
479+
{"shape": (2, 3, 4), "s": None, "axes": (0, 1)},
480480
{"shape": (2, 3, 4), "s": None, "axes": None},
481-
# {"shape": (2, 3, 4), "s": None, "axes": ()}, # mkl_fft gh-108
482-
# {"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)}, # mkl_fft gh-109
481+
{"shape": (2, 3, 4), "s": None, "axes": ()},
482+
{"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)},
483483
{"shape": (2, 3, 4), "s": (4, 3, 2), "axes": (2, 0, 1)},
484484
{"shape": (2, 3, 4, 5), "s": None, "axes": None},
485-
# {"shape": (0, 5), "s": None, "axes": None}, # mkl_fft gh-110
486-
# {"shape": (2, 0, 5), "s": None, "axes": None}, # mkl_fft gh-110
487-
# {"shape": (0, 0, 5), "s": None, "axes": None}, # mkl_fft gh-110
485+
{"shape": (0, 5), "s": None, "axes": None},
486+
{"shape": (2, 0, 5), "s": None, "axes": None},
487+
{"shape": (0, 0, 5), "s": None, "axes": None},
488488
],
489489
testing.product({"norm": [None, "backward", "ortho", "forward"]}),
490490
)
@@ -912,8 +912,7 @@ def test_rfft(self, xp, dtype):
912912
atol=2e-6,
913913
accept_error=ValueError,
914914
contiguous_check=False,
915-
# TODO: replace with has_support_aspect64() when mkl_fft-gh-180 is merged
916-
type_check=False,
915+
type_check=has_support_aspect64(),
917916
)
918917
def test_irfft(self, xp, dtype):
919918
a = testing.shaped_random(self.shape, xp, dtype)
@@ -1002,14 +1001,14 @@ def test_rfft_error_on_wrong_plan(self, dtype):
10021001
{"shape": (3, 4), "s": None, "axes": (-1, -2)},
10031002
{"shape": (3, 4), "s": None, "axes": (0,)},
10041003
{"shape": (3, 4), "s": None, "axes": None},
1005-
# {"shape": (2, 3, 4), "s": None, "axes": None}, # mkl_fft gh-116
1006-
# {"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-3, -2, -1)}, # mkl_fft gh-115
1007-
# {"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)}, # mkl_fft gh-116
1008-
# {"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)}, # mkl_fft gh-116
1004+
{"shape": (2, 3, 4), "s": None, "axes": None},
1005+
{"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-3, -2, -1)},
1006+
{"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)},
1007+
{"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)},
10091008
{"shape": (2, 3, 4), "s": None, "axes": (0, 1)},
10101009
{"shape": (2, 3, 4), "s": None, "axes": None},
10111010
{"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)},
1012-
# {"shape": (2, 3, 4, 5), "s": None, "axes": None}, # mkl_fft gh-109 and gh-116
1011+
{"shape": (2, 3, 4, 5), "s": None, "axes": None},
10131012
],
10141013
testing.product(
10151014
{"norm": [None, "backward", "ortho", "forward", ""]}
@@ -1044,8 +1043,7 @@ def test_rfft2(self, xp, dtype, order, enable_nd):
10441043
atol=1e-7,
10451044
accept_error=ValueError,
10461045
contiguous_check=False,
1047-
# TODO: replace with has_support_aspect64() when mkl_fft-gh-180 is merged
1048-
type_check=False,
1046+
type_check=has_support_aspect64(),
10491047
)
10501048
def test_irfft2(self, xp, dtype, order, enable_nd):
10511049
# assert config.enable_nd_planning == enable_nd
@@ -1090,13 +1088,13 @@ def test_irfft2(self, dtype):
10901088
{"shape": (3, 4), "s": None, "axes": (0,)},
10911089
{"shape": (3, 4), "s": None, "axes": None},
10921090
{"shape": (2, 3, 4), "s": None, "axes": None},
1093-
# {"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-3, -2, -1)}, # mkl_fft gh-115
1094-
# {"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)}, # mkl_fft gh-116
1095-
# {"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)}, # mkl_fft gh-116
1091+
{"shape": (2, 3, 4), "s": (1, 4, 10), "axes": (-3, -2, -1)},
1092+
{"shape": (2, 3, 4), "s": None, "axes": (-3, -2, -1)},
1093+
{"shape": (2, 3, 4), "s": None, "axes": (-1, -2, -3)},
10961094
{"shape": (2, 3, 4), "s": None, "axes": (0, 1)},
10971095
{"shape": (2, 3, 4), "s": None, "axes": None},
10981096
{"shape": (2, 3, 4), "s": (2, 3), "axes": (0, 1, 2)},
1099-
# {"shape": (2, 3, 4, 5), "s": None, "axes": None}, # mkl_fft gh-109 and gh-116
1097+
{"shape": (2, 3, 4, 5), "s": None, "axes": None},
11001098
],
11011099
testing.product(
11021100
{"norm": [None, "backward", "ortho", "forward", ""]}
@@ -1131,8 +1129,7 @@ def test_rfftn(self, xp, dtype, order, enable_nd):
11311129
atol=1e-7,
11321130
accept_error=ValueError,
11331131
contiguous_check=False,
1134-
# TODO: replace with has_support_aspect64() when mkl_fft-gh-180 is merged
1135-
type_check=False,
1132+
type_check=has_support_aspect64(),
11361133
)
11371134
def test_irfftn(self, xp, dtype, order, enable_nd):
11381135
# assert config.enable_nd_planning == enable_nd
@@ -1326,8 +1323,7 @@ class TestHfft:
13261323
atol=2e-6,
13271324
accept_error=ValueError,
13281325
contiguous_check=False,
1329-
# TODO: replace with has_support_aspect64() when mkl_fft-gh-180 is merged
1330-
type_check=False,
1326+
type_check=has_support_aspect64(),
13311327
)
13321328
def test_hfft(self, xp, dtype):
13331329
a = testing.shaped_random(self.shape, xp, dtype)

0 commit comments

Comments
 (0)