Skip to content

Commit 79404f7

Browse files
committed
Update fft tests
1 parent 9e081e3 commit 79404f7

File tree

1 file changed

+5
-62
lines changed

1 file changed

+5
-62
lines changed

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

Lines changed: 5 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ def test_ifftn_orders(self, dtype, enable_nd):
889889
pass
890890

891891

892-
# @testing.with_requires("numpy>=2.0")
892+
@testing.with_requires("numpy>=2.0")
893893
@pytest.mark.usefixtures("skip_forward_backward")
894894
@testing.parameterize(
895895
*testing.product(
@@ -925,17 +925,6 @@ def test_rfft(self, xp, dtype):
925925
def test_irfft(self, xp, dtype):
926926
a = testing.shaped_random(self.shape, xp, dtype)
927927
out = xp.fft.irfft(a, n=self.n, norm=self.norm)
928-
929-
if dtype == xp.float16 and xp is cupy:
930-
# XXX: np2.0: f16 dtypes differ
931-
out = out.astype(np.float16)
932-
elif (
933-
xp is np
934-
and np.lib.NumpyVersion(np.__version__) < "2.0.0"
935-
and dtype == np.float32
936-
):
937-
out = out.astype(np.float32)
938-
939928
return out
940929

941930

@@ -1008,7 +997,7 @@ def test_rfft_error_on_wrong_plan(self, dtype):
1008997
assert "Target array size does not match the plan." in str(ex.value)
1009998

1010999

1011-
# @testing.with_requires("numpy>=2.0")
1000+
@testing.with_requires("numpy>=2.0")
10121001
@pytest.mark.usefixtures("skip_forward_backward")
10131002
@testing.parameterize(
10141003
*(
@@ -1066,17 +1055,6 @@ def test_rfft2(self, xp, dtype, order, enable_nd):
10661055
)
10671056
def test_irfft2(self, xp, dtype, order, enable_nd):
10681057
# assert config.enable_nd_planning == enable_nd
1069-
1070-
if self.s is None and self.axes in [None, (-2, -1)]:
1071-
pytest.skip("Input is not Hermitian Symmetric")
1072-
elif dtype == xp.float16 and xp is cupy:
1073-
pytest.xfail("XXX: np2.0: f16 dtypes differ")
1074-
elif (
1075-
np.lib.NumpyVersion(np.__version__) < "2.0.0"
1076-
and dtype == np.float32
1077-
):
1078-
pytest.skip("dtypes differ")
1079-
10801058
a = testing.shaped_random(self.shape, xp, dtype)
10811059
if order == "F":
10821060
a = xp.asfortranarray(a)
@@ -1105,7 +1083,7 @@ def test_irfft2(self, dtype):
11051083
xp.fft.irfft2(a, s=self.s, axes=self.axes, norm=self.norm)
11061084

11071085

1108-
# @testing.with_requires("numpy>=2.0")
1086+
@testing.with_requires("numpy>=2.0")
11091087
@pytest.mark.usefixtures("skip_forward_backward")
11101088
@testing.parameterize(
11111089
*(
@@ -1163,17 +1141,6 @@ def test_rfftn(self, xp, dtype, order, enable_nd):
11631141
)
11641142
def test_irfftn(self, xp, dtype, order, enable_nd):
11651143
# assert config.enable_nd_planning == enable_nd
1166-
1167-
if self.s is None and self.axes in [None, (-2, -1)]:
1168-
pytest.skip("Input is not Hermitian Symmetric")
1169-
elif dtype == xp.float16 and xp is cupy:
1170-
pytest.xfail("XXX: np2.0: f16 dtypes differ")
1171-
elif (
1172-
np.lib.NumpyVersion(np.__version__) < "2.0.0"
1173-
and dtype == np.float32
1174-
):
1175-
pytest.skip("dtypes differ")
1176-
11771144
a = testing.shaped_random(self.shape, xp, dtype)
11781145
if order == "F":
11791146
a = xp.asfortranarray(a)
@@ -1243,10 +1210,6 @@ def test_rfftn(self, xp, dtype, enable_nd):
12431210
def test_irfftn(self, xp, dtype, enable_nd):
12441211
assert config.enable_nd_planning == enable_nd
12451212
a = testing.shaped_random(self.shape, xp, dtype)
1246-
1247-
if dtype == xp.float16 and xp is cupy:
1248-
pytest.xfail("XXX: np2.0: f16 dtypes differ")
1249-
12501213
if xp is np:
12511214
return xp.fft.irfftn(a, s=self.s, axes=self.axes, norm=self.norm)
12521215

@@ -1349,7 +1312,7 @@ def test_irfftn(self, dtype):
13491312
xp.fft.irfftn(a, s=self.s, axes=self.axes, norm=self.norm)
13501313

13511314

1352-
# @testing.with_requires("numpy>=2.0")
1315+
@testing.with_requires("numpy>=2.0")
13531316
@pytest.mark.usefixtures("skip_forward_backward")
13541317
@testing.parameterize(
13551318
*testing.product(
@@ -1373,17 +1336,6 @@ class TestHfft:
13731336
def test_hfft(self, xp, dtype):
13741337
a = testing.shaped_random(self.shape, xp, dtype)
13751338
out = xp.fft.hfft(a, n=self.n, norm=self.norm)
1376-
1377-
if dtype == xp.float16 and xp is cupy:
1378-
# XXX: np2.0: f16 dtypes differ
1379-
out = out.astype(np.float16)
1380-
elif (
1381-
xp is np
1382-
and np.lib.NumpyVersion(np.__version__) < "2.0.0"
1383-
and dtype == np.float32
1384-
):
1385-
out = out.astype(np.float32)
1386-
13871339
return out
13881340

13891341
@testing.for_all_dtypes(no_complex=True)
@@ -1396,16 +1348,7 @@ def test_hfft(self, xp, dtype):
13961348
)
13971349
def test_ihfft(self, xp, dtype):
13981350
a = testing.shaped_random(self.shape, xp, dtype)
1399-
out = xp.fft.ihfft(a, n=self.n, norm=self.norm)
1400-
1401-
if (
1402-
xp is np
1403-
and np.lib.NumpyVersion(np.__version__) < "2.0.0"
1404-
and dtype == np.float32
1405-
):
1406-
out = out.astype(np.complex64)
1407-
1408-
return out
1351+
return xp.fft.ihfft(a, n=self.n, norm=self.norm)
14091352

14101353

14111354
# @testing.with_requires("numpy>=2.0")

0 commit comments

Comments
 (0)