-
Notifications
You must be signed in to change notification settings - Fork 458
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
feat: added slice onnx import #1856
Conversation
959c74a
to
41c821d
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1856 +/- ##
==========================================
- Coverage 86.30% 86.10% -0.20%
==========================================
Files 774 777 +3
Lines 90072 90649 +577
==========================================
+ Hits 77733 78056 +323
- Misses 12339 12593 +254 ☔ View full report in Codecov by Sentry. |
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 tackling this op! 🙏
A couple of minor requests, and perhaps removing the commented code once everything is completed :)
let input = Tensor::<Backend, 2>::from_floats( | ||
[ | ||
[1., 2., 3., 4., 5., 6., 7., 8., 9., 10.], | ||
[1., 2., 3., 4., 5., 6., 7., 8., 9., 10.], |
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.
Maybe change the values of the second dim just to make it clear what data is sliced with this test 😅
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.
😃 right, yeah
// compine starts and ends into ranges | ||
// example: starts = [0, 0, 0, 0], ends = [1, 1, 1, 1] | ||
// ranges = [0..1, 0..1, 0..1, 0..1] | ||
let starts = &self.starts; | ||
let ends = &self.ends; |
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.
I think we still need to check the axes since there is no guarantee that they always including the leading axes (e.g., if axes = [2, 3]
for values of starts
and ends
), but it's not entirely clear even as described in the spec.
If we keep this solution without checking for non leading axes, I would at least parse the values of axes
and error on invalid/unsupported values (i.e., skipping leading axes).
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! 🚀
Thanks for making the changes and handling the cases we don't support for now.
Checklist
run-checks all
script has been executed.Related Issues/PRs
Helping with #1714
Changes
Added the slice import to onnx
Testing
cargo test -p burn-import --color=always -- --color=always
cargo test -p onnx-tests --color=always