You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want element-wise operations move above their commutatives (friends). See picture:
I don't want to encode every possible interchange pair, so must be generic element-wise and generic friend. Can I have it with current onnxscript (0.2.2) rewriter?
Solution
Use meta-abc node pairs like this:
In the attachment, there is prototype implementation.
It moves elementwise operations (ReLU and Tanh) above Identity and Flatten
For now, we encode elementwise wrappers as [Split(axis=20), Sub]
and wrappers of their friend as [Split(axis=30), Sub]
What do you think about this approach to generics?
The issue
Well, it works! But using Split and Sub as replacement to ABC_pre and ABC_post is obviously bad.
I actually tried to create custom pseudo-operation, but failed.
This text organized as
Problem to solve
I want element-wise operations move above their commutatives (friends). See picture:
I don't want to encode every possible interchange pair, so must be generic element-wise and generic friend. Can I have it with current
onnxscript
(0.2.2) rewriter?Use meta-abc node pairs like this:
In the attachment, there is prototype implementation.
It moves elementwise operations (ReLU and Tanh) above Identity and Flatten
cusops2ons.py.txt
test_generic_as_wrap.py.txt
For now, we encode elementwise wrappers as [Split(axis=20), Sub]
and wrappers of their friend as [Split(axis=30), Sub]
What do you think about this approach to generics?
Well, it works! But using Split and Sub as replacement to ABC_pre and ABC_post is obviously bad.
I actually tried to create custom pseudo-operation, but failed.
As I create op like this:
it not work with rewriter, also I tried onnxruntime_extensions.onnx_op
So, if it is possible, it would be great to have example of using rewriter with custom nodes.
The text was updated successfully, but these errors were encountered: