-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add more logical ops #109
Conversation
There was a problem hiding this 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)); |
There was a problem hiding this comment.
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))
).
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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. |
Add more logical ops
Fixed #108.
@fdwr @huningxin PTAL, thanks.