Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion array_api_strict/_set_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ def isin(x1: Array | int, x2: Array | int, /, *, invert: bool = False) -> Array:
# Call result type here just to raise on disallowed type combinations
_result_type(x1.dtype, x2.dtype)
# x1, x2 = Array._normalize_two_args(x1, x2) # no need to change 0D -> 1D here
return Array._new(np.isin(x1._array, x2._array), device=x1.device)
return Array._new(np.isin(x1._array, x2._array, invert=invert), device=x1.device)
6 changes: 6 additions & 0 deletions array_api_strict/tests/test_set_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ def test_inverse_indices_shape(func, x):
"""
out = func(x)
assert out.inverse_indices.shape == x.shape


def test_isin_invert():
x = xp.asarray([1, 2, 3])
excluded = xp.asarray([1, 3])
assert xp.all(xp.isin(x, excluded, invert=True) == xp.asarray([False, True, False]))
Loading