|
4 | 4 | import pytest
|
5 | 5 |
|
6 | 6 | import dpnp as cupy
|
| 7 | +from tests.helper import has_support_aspect64 |
7 | 8 | from tests.third_party.cupy import testing
|
8 | 9 |
|
9 | 10 |
|
@@ -97,6 +98,23 @@ def test_result_type(self, xp, dtype1, dtype2):
|
97 | 98 | input1 = _generate_type_routines_input(xp, dtype1, self.obj_type1)
|
98 | 99 |
|
99 | 100 | input2 = _generate_type_routines_input(xp, dtype2, self.obj_type2)
|
| 101 | + |
| 102 | + flag1 = isinstance(input1, (numpy.ndarray, cupy.ndarray)) |
| 103 | + flag2 = isinstance(input2, (numpy.ndarray, cupy.ndarray)) |
| 104 | + dt1 = cupy.dtype(input1) if not flag1 else None |
| 105 | + dt2 = cupy.dtype(input2) if not flag2 else None |
| 106 | + # dpnp takes into account devices capabilities only if one of the |
| 107 | + # inputs is an array, for such a case, if the other dtype is not |
| 108 | + # supported by device, dpnp raise ValueError. So, we skip the test. |
| 109 | + if flag1 or flag2: |
| 110 | + if ( |
| 111 | + dt1 in [cupy.float64, cupy.complex128] |
| 112 | + or dt2 in [cupy.float64, cupy.complex128] |
| 113 | + and not has_support_aspect64() |
| 114 | + ): |
| 115 | + pytest.skip("No fp64 support by device.") |
| 116 | + |
100 | 117 | ret = xp.result_type(input1, input2)
|
| 118 | + |
101 | 119 | assert isinstance(ret, numpy.dtype)
|
102 | 120 | return ret
|
0 commit comments