-
Notifications
You must be signed in to change notification settings - Fork 60
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: Add support for slice operator #171
base: master
Are you sure you want to change the base?
Conversation
Hi @raphaelmenges, happy to help! The issue with not returning the correct attribute may be related to the ONNX file you are using to test. Therefore I would suggest to add an as-simple-as-possible test case somewhere (have a look at the other test functions to see how to build an ONNX model from code). Then, either it works (and your ONNX file has an issue? Perhaps you can share it, or a simplified version, here) or it doesn't (in which case I can run it too and see what's wrong). It may also have something to do with the supported data types (vector attributes can be stored in different ways and not all of them may be implemented yet). |
I have added a simple test for slice that should reproduce the first example of the ONNX specification of slice. I am still a bit unsure about the data layout In the test, the attributes are correctly read in If the slice operator remains the last barrier to interfere our model I am eager to further investigate its implementation! |
Not sure what your question exactly is, but a short summary:
According to the documentation, the The WONNX optimizer in some cases moves such inputs to attributes for some operators if they are constant. Of course the input may also be calculated dynamically (and for some ops that is not supported).
|
Thank you @pixelspark for the extensive explanation! Your summary provides me indeed a good insight into the data structures which I would have struggled to gain from the code base alone. I would suggest to add these explanations to the contributor's section of the README of
I can confirm your finding. I have pushed according changes to my code. Our model seems to correctly report PS: I have a question about the operator version. To me it seems that there is quite some leap between v11 and v13 of the |
Hello 👋!
I need the slice operator (v11) to infer one of our models. I have seen in issue #153 that the slice operator is not yet implemented in
wonnx
, thus I plan to tackle the task. I have low experience in Rust, yet high in C++, and medium experience in compute shaders, mostly OpenGL 4. Therefore, I would suggest to treat this PR as basis to support me in understanding how to approach this venture. I have read the instructions from your README and attempted to get into the code of the project.I already fail at extracting the attribute values from a slice node of our model. It looks like all attributes according to the ONNX specification [1] are integer vectors. I have spotted in
wonnx/wonnx/src/compiler.rs
Line 821 in c772653
compiler.rs
it just returns the default values I defined [2]. What am I missing?I hope you are fine with my approach to this pull request. Otherwise I can also provide specific issues if desired.
Cheers,
Raphael
[1] https://onnx.ai/onnx/operators/onnx__Slice.html#slice-11
[2] https://github.com/semanux/wonnx/blob/05202639b25d4020478135dbdc717a04ea08a16d/wonnx/src/compiler.rs#L463