burn
burn copied to clipboard
MatMulInteger
Add MatMulInteger ONNX operation to Burn
Hello, Burn community! I'm trying to add MatMulInteger to burn-import
Checklist
- [ ] Confirmed that
run-checks allscript has been executed. - [ ] Made sure the book is up to date with changes in this PR.
Related Issues/PRs
This PR addresses part of issue #1714 which requests implementation of missing ONNX operations in the burn-import crate. Specifically, it implements the MatMulInteger operation which was listed under "Harder Ops (Not Similar to Existing Implemented Ops)".
Changes
This PR implements the MatMulInteger (ONNX opset 10) operation in the burn-import crate, allowing users to import ONNX models that utilize quantized matrix multiplication. The implementation:
- Creates a new
MatMulIntegerNodestructure to handle the operation - Implements proper dimension handling and broadcasting for tensors with different ranks
- Supports optional zero points for quantized inputs (both scalar and tensor)
- Follows the ONNX specification for integer matrix multiplication
- Handles the conversion of quantized inputs with appropriate zero point subtraction
Testing
- [x] Unit tests for code generation that verify the correct Rust code is produced
- [ ] Validation of tensor types to ensure compatibility with ONNX specifications (int8/uint8 inputs, int32 outputs)
- [ ] Proper handling of different tensor dimensions with broadcasting
- [ ] Tests for both scalar and tensor-based zero points
Additional integration tests with actual ONNX models containing the MatMulInteger op will be added.
Also, ignore the macos CI failing.. we're having issues with the space on the runners since yesterday 🥲
Codecov Report
Attention: Patch coverage is 79.87013% with 31 lines in your changes missing coverage. Please review.
Project coverage is 82.17%. Comparing base (
2dfb3d4) to head (5cb4e2a). Report is 3 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| crates/burn-import/src/burn/node/matmul_integer.rs | 79.87% | 31 Missing :warning: |
:x: Your patch check has failed because the patch coverage (79.87%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
Additional details and impacted files
@@ Coverage Diff @@
## main #2846 +/- ##
========================================
Coverage 82.17% 82.17%
========================================
Files 854 855 +1
Lines 114001 114214 +213
========================================
+ Hits 93676 93858 +182
- Misses 20325 20356 +31
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This PR has been marked as stale because it has not been updated for over a month
This PR has been marked as stale because it has not been updated for over a month
Implemented by https://github.com/tracel-ai/burn/pull/3672