-
Notifications
You must be signed in to change notification settings - Fork 645
Add onnx SpaceToDepth / DepthToSpace #3277
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
b654cfa
to
51073ee
Compare
51073ee
to
52e8374
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3277 +/- ##
==========================================
+ Coverage 82.33% 82.36% +0.03%
==========================================
Files 978 984 +6
Lines 124869 125445 +576
==========================================
+ Hits 102808 103329 +521
- Misses 22061 22116 +55 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Just noticed #2464, maybe it make sense to implement it as separate module in burn-core? |
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 minor comment, otherwise LGTM!
Thanks for the addition 🙏
crates/burn-import/onnx-tests/tests/depth_to_space/depth_to_space.py
Outdated
Show resolved
Hide resolved
crates/burn-import/onnx-tests/tests/space_to_depth/space_to_depth.py
Outdated
Show resolved
Hide resolved
// Infer static shape based on rank and block size | ||
let static_shape = tensor.static_shape.clone().map(|shape| { | ||
let [b, c, h, w] = shape | ||
.try_into() | ||
.expect("DepthToSpace: input tensor rank is not 4"); | ||
vec![ | ||
b, | ||
c / (block_size * block_size), | ||
h * block_size, | ||
w * block_size, | ||
] | ||
}); |
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.
Not required, but since this will only be applied if the static shape is available we can keep it :)
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.
As i see across code, some operators require static shape, this is reason why i added it
* feat: add support for DepthToSpace onnx node * feat: add support for SpaceToDepth onnx node * fix: ci * fix: add missing SpaceToDepth rank_inference * fix: mark supported onnx nodes * test: fix tests * fix: set opset version to 16
Pull Request Template
Checklist
cargo run-checks
command has been executed.Related Issues/PRs
#1714, #2930
Changes
Adding support for SpaceToDepth / DepthToSpace onnx nodes
Testing
Added a bunch of tests