-
Notifications
You must be signed in to change notification settings - Fork 64
Add permute and pow ops and fix attribute value issue. #293
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
fatcat-z
commented
Jan 9, 2023
•
edited by justinchuby
Loading
edited by justinchuby
- Add 2 new ops: permute and pow.
- Fix (partially) Inputs and attributes could not be separated by _adapt_to_eager_mode method. #287: convert the values of attributes from tensor back to numpy value when we call Op.
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. I would wait for @gramalingam
Codecov Report
@@ Coverage Diff @@
## main #293 +/- ##
==========================================
+ Coverage 73.04% 73.13% +0.08%
==========================================
Files 97 97
Lines 9461 9472 +11
==========================================
+ Hits 6911 6927 +16
+ Misses 2550 2545 -5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Hi, a quick question: if I understand right, the code change converts attribute values that are tensors into numpy arrays. First, I don't think that would fix issue 287 (completely). That's not a problem, just want to clarify that the PR description is a bit misleading. I believe we will still need to do something extra to resolve 287 fully. Or, did I misunderstand? Maybe this change fixes the issue for a particular example? Can you point me to the example where this is used? I don't see it in this PR's changes. Thanks. |
In aten_permute() method, the value of dims will be changed to tensors which are not expected by onnx.helper.make_attribute() function. In eager mode, when we call an aten_xxx() method, all of positional inputs of it will be changed to tensors by _adapt_to_eager_mode() method. But inside the function, we still need to keep some of inputs to be a Numpy value (in aten_permute, it is 'dims') so that we can pass it into ONNX op as an attribute. This will only happen in eager mode because _adapt_to_eager_mode will only be called in such mode. Probably I need to update the #287 for a clarification? |
Signed-off-by: Jay Zhang <[email protected]>
Signed-off-by: Jay Zhang <[email protected]>
Signed-off-by: Jay Zhang <[email protected]>
Signed-off-by: Jay Zhang <[email protected]>
Signed-off-by: Jay Zhang <[email protected]>
Ok. My main question is whether this positional input of the aten_xxx() method is supposed to be an attribute (of aten_xxx) or an input (of aten_xxx)? I understand the first case: the problem happens if attributes are passed in positionally instead of as a keyword-argument. We can fix this. The second case, however, cannot be supported in ONNX. Specifically, in ONNX, there is no way to convert an input (which is not statically known) into an attribute. I just want to clarify this ... we should NOT be writing such functions. |
In the first case (where |
skip( | ||
"slice", | ||
# kwargs {dim, start, end, step} is empty, we cannot give the default value | ||
matcher=lambda sample: len(sample.kwargs) == 0, |
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.
Could you help me understand why this is needed better?
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.
This was not introduced by this PR, it was submitted by another PR #304