Skip to content

Commit 94be1c8

Browse files
committed
Speed up
1 parent fa24021 commit 94be1c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

array_api_compat/common/_aliases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,13 @@ def _isscalar(a):
376376
if min is not None:
377377
a = wrapped_xp.asarray(min, dtype=x.dtype, device=dev)
378378
a = xp.broadcast_to(a, result_shape)
379-
ia = (out < a) | xp.isnan(a)
379+
ia = ~(out >= a) # Propagate NaNs
380380
out[ia] = a[ia]
381381

382382
if max is not None:
383383
b = wrapped_xp.asarray(max, dtype=x.dtype, device=dev)
384384
b = xp.broadcast_to(b, result_shape)
385-
ib = (out > b) | xp.isnan(b)
385+
ib = ~(out <= b) # Propagate NaNs
386386
out[ib] = b[ib]
387387

388388
# Return a scalar for 0-D

0 commit comments

Comments
 (0)