Skip to content

Commit f20a03d

Browse files
committed
Use device-supported float dtype in argmax/argmin overflow tests
test_arg{max,min}_int32_overflow allocated float64 arrays, which dpnp downcasts to float32 on devices without fp64 support. Build them at cupy.default_float_type() instead; the argmax/argmin index is dtype-independent so the assertion is unchanged.
1 parent 8870286 commit f20a03d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎dpnp/tests/third_party/cupy/sorting_tests/test_search.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_argmax_zero_size_axis1(self, xp, dtype):
9090
@testing.slow
9191
# @pytest.mark.thread_unsafe(reason="allocation too large.")
9292
def test_argmax_int32_overflow(self):
93-
a = cupy.arange(2**32 + 1, dtype=cupy.float64)
93+
a = cupy.arange(2**32 + 1, dtype=cupy.default_float_type())
9494
assert a.argmax().item() == 2**32
9595

9696
@testing.for_all_dtypes(no_complex=True)
@@ -170,7 +170,7 @@ def test_argmin_zero_size_axis1(self, xp, dtype):
170170
@testing.slow
171171
# @pytest.mark.thread_unsafe(reason="allocation too large.")
172172
def test_argmin_int32_overflow(self):
173-
a = cupy.arange(2**32 + 1, dtype=cupy.float64)
173+
a = cupy.arange(2**32 + 1, dtype=cupy.default_float_type())
174174
cupy.negative(a, out=a)
175175
assert a.argmin().item() == 2**32
176176

0 commit comments

Comments
 (0)