Skip to content

Commit c5e6acb

Browse files
Resolve gh-1744
Applied suggested changes to replace Python min/max ints which are out of bounds for array integral data type with None.
1 parent 0ec8cfb commit c5e6acb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

dpctl/tensor/_clip.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
404404
)
405405
if order not in ["K", "C", "F", "A"]:
406406
order = "K"
407+
if x.dtype.kind in "iu":
408+
if isinstance(min, int) and min <= dpt.iinfo(x.dtype).min:
409+
min = None
410+
if isinstance(max, int) and max >= dpt.iinfo(x.dtype).max:
411+
max = None
407412
if min is None and max is None:
408413
exec_q = x.sycl_queue
409414
orig_out = out

0 commit comments

Comments
 (0)