-
Notifications
You must be signed in to change notification settings - Fork 645
Add support onnx instance norm #3177
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3177 +/- ##
==========================================
+ Coverage 82.14% 82.19% +0.04%
==========================================
Files 956 962 +6
Lines 121842 122340 +498
==========================================
+ Hits 100090 100559 +469
- Misses 21752 21781 +29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR adds support for ONNX InstanceNormalization by integrating it throughout the IR, conversion, codegen, and tests. Key changes include:
- Adding a new InstanceNormalization branch in rank inference and node modules.
- Implementing InstanceNorm configuration and code generation in onnx-ir and burn-import.
- Integrating InstanceNormalization tests and updating documentation and build scripts.
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
crates/onnx-ir/src/rank_inference.rs | Added InstanceNormalization handling in rank inference |
crates/onnx-ir/src/node/mod.rs | Registered new instance_norm module |
crates/onnx-ir/src/node/instance_norm.rs | Introduced InstanceNormConfig and its tests |
crates/onnx-ir/src/from_onnx.rs | Added InstanceNormalization conversion logic |
crates/burn-import/src/onnx/to_burn.rs | Integrated InstanceNorm conversion into the Burn graph conversion |
crates/burn-import/src/burn/node/mod.rs | Registered InstanceNorm in the burn node enum |
crates/burn-import/src/burn/node/instance_norm.rs | Implemented InstanceNorm node codegen and serialization |
crates/burn-import/onnx-tests | Added InstanceNormalization onnx tests (1d, 2d, and 3d) |
crates/burn-import/SUPPORTED-ONNX-OPS.md | Updated InstanceNormalization support status |
for (key, value) in node.attrs.iter() { | ||
match key.as_str() { | ||
"epsilon" => epsilon = value.clone().into_f32(), | ||
_ => panic!("Unexpected attribute for InstanceNorm: {key}"), |
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.
Consider handling unexpected attributes in InstanceNorm more gracefully, for example by logging a warning or returning an error instead of panicking, to improve robustness.
Copilot uses AI. Check for mistakes.
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 and clean implementation.
Thank you again for your contribution!
* feat: support onnx instance norm * fix: fix ci * fix: fix typo
Pull Request Template
Checklist
cargo run-checks
command has been executed.Related Issues/PRs
#1714, #673
Changes
Adding InstanceNorm onnx support
Testing
Added tests for 1d, 2d and 3d