-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 bitwiseAnd() ops #7645
Add bitwiseAnd() ops #7645
Conversation
fengwuyao
commented
May 2, 2023
- Implemented the bitwiseAnd() ops
- Added the kernel in CPU backend
- Example usage:
a13ef70
to
b30f498
Compare
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.
LGTM!
tfjs-converter/src/operations/executors/transformation_executor_test.ts
Outdated
Show resolved
Hide resolved
@@ -19,6 +19,7 @@ | |||
export {simpleAbsImpl} from './kernels/Abs'; | |||
export {addImpl} from './kernels/Add'; | |||
export {bincountImpl, bincountReduceImpl} from './kernels/Bincount_impl'; | |||
export {bitwiseAndImpl} from './kernels/BitwiseAnd'; |
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.
Nice catch. Adding it here means other backend could use this kernel implementation. We could discuss this later when implementing this kernel for other backends.
tfjs-core/src/ops/bitwise_and.ts
Outdated
throw new Error(`BitwiseAnd: Tensors must have the same shape. x: ${ | ||
$x.shape}, y: ${$y.shape}`); | ||
} | ||
if ($x.dtype !== 'float32' || $y.dtype !== 'float32') { |
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.
should it be 'int32'?
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.
Thanks for pointing out. Updated.
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.
Just a nit. LGTM, this is very fast! Thanks!