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

Add more logical ops #109

Merged
merged 3 commits into from
Oct 30, 2024
Merged

Conversation

BruceDai
Copy link
Contributor

Fixed #108.

@fdwr @huningxin PTAL, thanks.

Copy link

@fdwr fdwr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 thoughts, else LGTM Bruce.

src/logical.js Outdated
@@ -28,4 +28,9 @@ export const greaterOrEqual =
export const lesser = (inputA, inputB) => binary(inputA, inputB, (a, b) => (a < b ? 1 : 0));
export const lesserOrEqual =
(inputA, inputB) => binary(inputA, inputB, (a, b) => (a <= b ? 1 : 0));
export const not = (input) => logicalNot(input);
export const logicalAnd =
(inputA, inputB) => binary(inputA, inputB, (a, b) => ((a > 0) && (b > 0) ? 1: 0));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically it doesn't matter whether we use > 0 or != 0 here, since WebNN only takes unsigned inputs anyway, but for general correctness, any nonzero value would apply. So (!!a && !!b ? 1 : 0)) would be a little more correct (or the more verbose ((a != 0) && (b != 0) ? 1 : 0))).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I‘ve updated in new commit, please take another look, thanks!

Copy link

@fdwr fdwr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@fdwr
Copy link

fdwr commented Oct 29, 2024

Is Ningxin the person who can merge this?

@BruceDai
Copy link
Contributor Author

Is Ningxin the person who can merge this?

Yes. Ningxin is very busy, he maybe miss this pr. I will ping Ningxin offline to help merge it. Thanks.

@huningxin huningxin merged commit 4febe57 into webmachinelearning:main Oct 30, 2024
3 checks passed
BruceDai pushed a commit to BruceDai/webnn-baseline-1 that referenced this pull request Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement logicalAnd / logicalOr / logicalXor ops
3 participants