We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b52cb84 commit f809733Copy full SHA for f809733
array_api_compat/cupy/_aliases.py
@@ -167,6 +167,15 @@ def searchsorted(
167
return cp.searchsorted(x1, x2, side, sorter)
168
169
170
+# CuPy isin does not accept scalars
171
+def isin(x1: Array | int, x2: Array | int, /, *, invert: bool = False, **kwds) -> Array:
172
+ if isinstance(x1, int):
173
+ x1 = cp.asarray(x1)
174
+ if isinstance(x2, int):
175
+ x2 = cp.asarray(x2)
176
+ return cp.isin(x1, x2, invert=invert, **kwds)
177
+
178
179
# These functions are completely new here. If the library already has them
180
# (i.e., numpy 2.0), use the library version instead of our wrapper.
181
if hasattr(cp, 'vecdot'):
@@ -191,7 +200,7 @@ def searchsorted(
191
200
'bool', 'concat', 'count_nonzero', 'pow', 'sign',
192
201
'ceil', 'floor', 'trunc', 'take_along_axis',
193
202
'broadcast_arrays', 'meshgrid',
194
- 'searchsorted',
203
+ 'searchsorted', 'isin',
195
204
]
196
205
197
206
0 commit comments