Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Operator] Add isin op #188

Merged
merged 20 commits into from
Sep 6, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[Operator] Add scalar isin op
  • Loading branch information
zhengyang committed Sep 5, 2024
commit 78d6b401a10815d9001e8b16f376e72cee4d160c
12 changes: 6 additions & 6 deletions tests/test_special_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,14 +459,14 @@ def test_accuracy_isin(shape, dtype, assume_unique, invert):
ref_out = torch.isin(ref_inp1, ref_inp2, assume_unique=assume_unique, invert=invert)
gems_assert_equal(res_out, ref_out)

inp1_scalar = inp1.ravel()[0].item()
inp1_s = inp1.ravel()[0].item()
with flag_gems.use_gems():
res1_out = torch.isin(inp1_scalar, inp2, assume_unique=assume_unique, invert=invert)
ref1_out = torch.isin(inp1_scalar, ref_inp2, assume_unique=assume_unique, invert=invert)
res1_out = torch.isin(inp1_s, inp2, assume_unique=assume_unique, invert=invert)
ref1_out = torch.isin(inp1_s, ref_inp2, assume_unique=assume_unique, invert=invert)
gems_assert_equal(res1_out, ref1_out)

inp2_scalar = inp2.ravel()[0].item()
inp2_s = inp2.ravel()[0].item()
with flag_gems.use_gems():
res2_out = torch.isin(inp1, inp2_scalar, assume_unique=assume_unique, invert=invert)
ref2_out = torch.isin(ref_inp1, inp2_scalar, assume_unique=assume_unique, invert=invert)
res2_out = torch.isin(inp1, inp2_s, assume_unique=assume_unique, invert=invert)
ref2_out = torch.isin(ref_inp1, inp2_s, assume_unique=assume_unique, invert=invert)
gems_assert_equal(res2_out, ref2_out)