Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
518fd6a
Implement tensor.isin
ndgrigorian Jun 6, 2025
85106f4
factor common utilities for scalar arguments to a new file
ndgrigorian Jun 8, 2025
ce757c8
Make constexpr variables in `isin` static
ndgrigorian Jun 11, 2025
8425cdc
Update implementation of `isin`
ndgrigorian Jun 11, 2025
204025a
Update per review comments
ndgrigorian Jun 16, 2025
cfb5154
Allow x to be a scalar in isin and remove assume_unique
ndgrigorian Jun 16, 2025
a448725
Make comparator static constexpr
ndgrigorian Jun 16, 2025
882a431
add basic tests for isin functionality
ndgrigorian Jun 17, 2025
d11626c
Remove unused import of dpctl in _set_functions.py
ndgrigorian Jun 17, 2025
710a6d0
Add type hints to isin
ndgrigorian Jun 17, 2025
411b976
Add usm_type to test_buf in isin
ndgrigorian Jun 18, 2025
3077bd6
Address review comments for isin tests
ndgrigorian Jun 18, 2025
ed9f376
Add test covering nans and +/- 0 in isin
ndgrigorian Jun 18, 2025
72278b5
Add test for isin with Python scalar args
ndgrigorian Jun 23, 2025
5b877c8
Add test for combinations of dtypes as inputs to isin
ndgrigorian Jun 23, 2025
538176c
Add compute follows data test for isin
ndgrigorian Jun 23, 2025
0cd24f5
Add isin to rendered docs
ndgrigorian Jun 23, 2025
0070331
Test that isin output is C-contiguous when input is strided
ndgrigorian Jun 23, 2025
2ebb3a1
improve formatting of isin docstring
ndgrigorian Jun 26, 2025
26f68d2
move rich_comparisons.hpp into utils
ndgrigorian Sep 11, 2025
365c3b4
factor out compare template param in isin
ndgrigorian Sep 11, 2025
44661ba
add missing includes to rich_comparisons
ndgrigorian Sep 17, 2025
62a9fa4
drop unused includes in isin kernel implementation
ndgrigorian Sep 17, 2025
ff68bca
validate that `invert` kwarg is boolean
ndgrigorian Sep 17, 2025
e28e1aa
add a test for input validation of invert
ndgrigorian Sep 17, 2025
68bc84e
make invert bool type check stricter
ndgrigorian Sep 17, 2025
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
Prev Previous commit
Next Next commit
Add type hints to isin
  • Loading branch information
ndgrigorian committed Sep 17, 2025
commit 710a6d02528fc9a9399bb882dc2b4068bbe7491d
10 changes: 8 additions & 2 deletions dpctl/tensor/_set_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import NamedTuple
from typing import NamedTuple, Optional, Union

import dpctl.tensor as dpt
import dpctl.utils as du
Expand Down Expand Up @@ -639,7 +639,13 @@ def unique_all(x: dpt.usm_ndarray) -> UniqueAllResult:
)


def isin(x, test_elements, /, *, invert=False):
def isin(
Comment thread
ndgrigorian marked this conversation as resolved.
x: Union[dpt.usm_ndarray, int, float, complex, bool],
test_elements: Union[dpt.usm_ndarray, int, float, complex, bool],
/,
*,
invert: Optional[bool] = False,
) -> dpt.usm_ndarray:
"""
Tests `x in test_elements` for each element of `x`. Returns a boolean array
with the same shape as `x` that is `True` where the element is in
Expand Down