File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 9
9
assert_dtype_allclose ,
10
10
get_float_dtypes ,
11
11
has_support_aspect64 ,
12
+ is_cpu_device ,
12
13
)
13
14
14
15
@@ -27,10 +28,20 @@ def test_sum_float(dtype):
27
28
)
28
29
ia = dpnp .array (a )
29
30
31
+ # Flag for type check in special cases
32
+ # Skip dtype checks when dpnp handles float32 arrays on CPU
33
+ # as `dpnp.sum()` and `numpy.sum()` return different dtypes:
34
+ # numpy - 'float32', dpnp - 'float64'
35
+ check_dtype = (ia .dtype != dpnp .float32 ) or not is_cpu_device (
36
+ ia .sycl_device
37
+ )
30
38
for axis in range (len (a )):
31
39
result = dpnp .sum (ia , axis = axis )
32
40
expected = numpy .sum (a , axis = axis )
33
- assert_dtype_allclose (result , expected )
41
+ assert_dtype_allclose (result , expected , check_type = check_dtype )
42
+ if not check_dtype :
43
+ # Ensure dtype kind matches when check_dtype is False
44
+ assert result .dtype .kind == expected .dtype .kind
34
45
35
46
36
47
def test_sum_int ():
You can’t perform that action at this time.
0 commit comments