13
13
get_all_dtypes ,
14
14
get_complex_dtypes ,
15
15
get_float_dtypes ,
16
- is_cpu_device ,
17
16
)
18
17
19
- # aspects of default device:
20
- _def_device = dpctl .SyclQueue ().sycl_device
21
- _def_dev_has_fp64 = _def_device .has_aspect_fp64
22
- is_gpu_with_fp64 = not is_cpu_device () and _def_dev_has_fp64
23
-
24
18
25
19
# TODO: `assert_dtype_allclose` calls in this file have `check_only_type_kind=True`
26
20
# since stock NumPy is currently used in public CI for code coverege which
@@ -498,13 +492,13 @@ def test_fft_1D(self, dtype, n, norm):
498
492
# but dpnp return float32 if input is float32
499
493
assert_dtype_allclose (result , expected , check_only_type_kind = True )
500
494
501
- @pytest .mark .skipif (is_gpu_with_fp64 , reason = "MKLD17702" )
502
495
@pytest .mark .parametrize ("dtype" , get_complex_dtypes ())
503
496
@pytest .mark .parametrize ("n" , [None , 5 , 20 ])
504
497
@pytest .mark .parametrize ("norm" , ["forward" , "backward" , "ortho" ])
505
498
def test_fft_1D_complex (self , dtype , n , norm ):
506
499
x = dpnp .linspace (- 1 , 1 , 11 )
507
500
a = dpnp .sin (x ) + 1j * dpnp .cos (x )
501
+ a [0 ].imag = 0 # input should be complex Hermitian
508
502
a = dpnp .asarray (a , dtype = dtype )
509
503
a_np = dpnp .asnumpy (a )
510
504
@@ -525,29 +519,37 @@ def test_fft_1D_on_2D_array(self, dtype, n, axis, norm, order):
525
519
expected = numpy .fft .irfft (a_np , n = n , axis = axis , norm = norm )
526
520
assert_dtype_allclose (result , expected , check_only_type_kind = True )
527
521
528
- @pytest .mark .skipif (is_gpu_with_fp64 , reason = "MKLD17702" )
529
522
@pytest .mark .parametrize ("dtype" , get_complex_dtypes ())
530
523
@pytest .mark .parametrize ("n" , [None , 5 , 8 ])
531
524
@pytest .mark .parametrize ("axis" , [0 , 1 , 2 ])
532
525
@pytest .mark .parametrize ("norm" , ["forward" , "backward" , "ortho" ])
533
526
@pytest .mark .parametrize ("order" , ["C" , "F" ])
534
527
def test_fft_1D_on_3D_array (self , dtype , n , axis , norm , order ):
535
- x1 = numpy .random .uniform (- 10 , 10 , 24 )
536
- x2 = numpy .random .uniform (- 10 , 10 , 24 )
528
+ x1 = numpy .random .uniform (- 10 , 10 , 36 )
529
+ x2 = numpy .random .uniform (- 10 , 10 , 36 )
537
530
a_np = numpy .array (x1 + 1j * x2 , dtype = dtype ).reshape (
538
- 2 , 3 , 4 , order = order
531
+ 3 , 3 , 4 , order = order
539
532
)
533
+ # each 1-D array of input should be complex Hermitian
534
+ a_np [0 ].imag = 0
535
+ a_np [:, 0 , :].imag = 0
536
+ a_np [..., 0 ].imag = 0
537
+ a_np [..., - 1 ].imag = 0 # Nyquist mode for 3rd dimension
538
+
539
+ a_np = numpy .array (x1 , dtype = dtype ).reshape (
540
+ 2 , 3 , 4 , order = order
541
+ ) # input should be complex Hermitian
540
542
a = dpnp .asarray (a_np )
541
543
542
544
result = dpnp .fft .irfft (a , n = n , axis = axis , norm = norm )
543
545
expected = numpy .fft .irfft (a_np , n = n , axis = axis , norm = norm )
544
546
assert_dtype_allclose (result , expected , check_only_type_kind = True )
545
547
546
- @pytest .mark .skipif (is_gpu_with_fp64 , reason = "MKLD17702" )
547
548
@pytest .mark .parametrize ("n" , [None , 5 , 20 ])
548
549
def test_fft_usm_ndarray (self , n ):
549
550
x = dpt .linspace (- 1 , 1 , 11 )
550
551
a = dpt .sin (x ) + 1j * dpt .cos (x )
552
+ a [0 ] = dpt .sin (x [0 ]) # input should be complex Hermitian
551
553
a_usm = dpt .asarray (a , dtype = dpt .complex64 )
552
554
a_np = dpt .asnumpy (a_usm )
553
555
out_shape = n if n is not None else 2 * (a_usm .shape [0 ] - 1 )
@@ -558,13 +560,13 @@ def test_fft_usm_ndarray(self, n):
558
560
expected = numpy .fft .irfft (a_np , n = n )
559
561
assert_dtype_allclose (result , expected , check_only_type_kind = True )
560
562
561
- @pytest .mark .skipif (is_gpu_with_fp64 , reason = "MKLD17702" )
562
563
@pytest .mark .parametrize ("dtype" , get_complex_dtypes ())
563
564
@pytest .mark .parametrize ("n" , [None , 5 , 20 ])
564
565
@pytest .mark .parametrize ("norm" , ["forward" , "backward" , "ortho" ])
565
566
def test_fft_1D_out (self , dtype , n , norm ):
566
567
x = dpnp .linspace (- 1 , 1 , 11 )
567
568
a = dpnp .sin (x ) + 1j * dpnp .cos (x )
569
+ a [0 ].imag = 0 # input should be complex Hermitian
568
570
a = dpnp .asarray (a , dtype = dtype )
569
571
a_np = dpnp .asnumpy (a )
570
572
0 commit comments