Skip to content

Commit c4dab5d

Browse files
authored
Avoid overflow in linspace test (#2451)
The PR resolves overflow issue observing in `test_linspace_mixed_start_stop2` test when running with `DPNP_TEST_ALL_INT_TYPES=1` on ARL-S machine.
1 parent 8c1b28e commit c4dab5d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

dpnp/tests/third_party/cupy/creation_tests/test_ranges.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,13 @@ def test_linspace_mixed_start_stop2(self, xp, dtype_range, dtype_out):
226226
# TODO (ev-br): np 2.0: check if can re-enable float16
227227
# TODO (ev-br): np 2.0: had to bump the default rtol on Windows
228228
# and numpy 1.26+weak promotion from 0 to 5e-6
229-
if xp.dtype(dtype_range).kind in "u":
229+
if xp.dtype(dtype_range).kind == "u":
230230
# to avoid overflow, limit `val` to be smaller
231231
# than xp.iinfo(dtype).max
232-
if dtype_range in [xp.uint8, xp.uint16] or dtype_out == xp.uint8:
232+
if dtype_range in [xp.uint8, xp.uint16] or dtype_out in [
233+
xp.int8,
234+
xp.uint8,
235+
]:
233236
val = 125
234237
else:
235238
val = 160

0 commit comments

Comments
 (0)