Skip to content

Commit b280036

Browse files
committed
diff now uses not_equal when the input is boolean
1 parent 6c8a61f commit b280036

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dpctl/tensor/_utility_functions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,8 @@ def diff(x, /, *, axis=-1, n=1, prepend=None, append=None):
464464
slice(None) if i != axis else slice(None, -1) for i in range(x_nd)
465465
)
466466

467+
diff_op = dpt.not_equal if x.dtype == dpt.bool else dpt.subtract
467468
for _ in range(n):
468-
arr = arr[sl0] - arr[sl1]
469+
arr = diff_op(arr[sl0], arr[sl1])
469470

470471
return arr

0 commit comments

Comments
 (0)