-
Notifications
You must be signed in to change notification settings - Fork 619
Adding bitwise ONNX ops #3120
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
base: main
Are you sure you want to change the base?
Adding bitwise ONNX ops #3120
Conversation
…tensor types in bitwise operations
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.
Looks like the scalar case is not correctly handled (see CI errors).
Also, the ONNX tests refactor in #3144 (merged) have introduced a minor conflict with the removal of the test_onnx.rs
file.
All major reorg refactoring is done. Let me know if you need to help with merging. Please see updated book section: cargo xtask books contributor open You can also pick into a recent PR merged with tests/configuration locations: #3177 |
This PR has been marked as stale because it has not been updated for over a month |
I can finish it when I am back |
Updated bitwise and bitshift node implementations to accept both tensor and scalar inputs via the Type enum, enabling proper handling of scalar operations. Adjusted code generation logic and import registration for scalar cases, and updated ONNX conversion functions to use Type instead of TensorType. Also fixed a test expectation in bitwise_xor and enabled bitwise tests in test_mod.rs.
Rewrote bitshift.py to generate ONNX models directly using the onnx API, supporting both tensor and scalar shift inputs. Updated all BitShift ONNX test models to match the new generation method and re-enabled the bitshift test module in test_mod.rs.
Replaced direct bitwise operators with corresponding Tensor methods (e.g., bitwise_and, bitwise_or, bitwise_not, bitwise_xor, bitwise_left_shift, bitwise_right_shift) in test modules for bitwise node implementations. Also updated input type registration in BitwiseAndNode tests for consistency.
@laggui I have resolved all merge issues (and fixed some additional). Ready for review. |
Marked BitShift, BitwiseAnd, BitwiseNot, BitwiseOr, BitwiseXor, and IsInf as supported in the ONNX ops table for both import and export. This reflects recent changes in operator support.
Codecov ReportAll modified and coverable lines are covered by tests ✅
❌ Your project check has failed because the head coverage (35.19%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #3120 +/- ##
=======================================
Coverage 35.19% 35.19%
=======================================
Files 342 342
Lines 53164 53164
=======================================
Hits 18709 18709
Misses 34455 34455 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Thanks! Will have a look soon |
Pull Request Template
Checklist
run-checks all
script has been executed.Related Issues/PRs
#1714
Changes
Developed the bitwise operators in burn while following the steps from the contributor book:
BitShift
BitwiseAnd
BitwiseNot
BitwiseOr
BitwiseXor
Testing
Developed unit tests for each of the bitwise operators.