-
Notifications
You must be signed in to change notification settings - Fork 82
feat(atenlib): ops 2/n #252
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
To allow mypy to analyze typing for annotated functions. Otherwise it complains that "Untyped decorator makes function "ones_like" untyped [misc]" [ghstack-poisoned]
[ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
Implemented ops - lt - gt - round - clamp_min - clamp_max - clamp - repeat - ones_like Test: - Create the ability to skip particular sub tests - Create a helper function to transform torch inputs into numpy for onnxscript to run on [ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
Codecov Report
@@ Coverage Diff @@
## main #252 +/- ##
==========================================
+ Coverage 71.82% 71.93% +0.10%
==========================================
Files 93 93
Lines 8899 8917 +18
==========================================
+ Hits 6392 6414 +22
+ Misses 2507 2503 -4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@@ -4461,7 +4459,13 @@ def aten_symeig( | |||
def aten_t(self: TensorType) -> TensorType: | |||
# t(Tensor(a) self) -> Tensor(a) | |||
|
|||
raise NotImplementedError() | |||
# TODO(justinchuby): Make rank a function | |||
rank = op.Shape(op.Shape(self)) # type: ignore[arg-type] |
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.
Should it be: rank = op.Size(op.Shape(self)) ?
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.
Good call! I didn’t know there’s Size. Will update
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.
Done
# linear(Tensor input, Tensor weight, Tensor? bias=None) -> Tensor | ||
|
||
raise NotImplementedError() | ||
# FIXME(justinchuby): Enable the 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.
In current PyTorch exporter, if the rank of input is 2 and the node of bias is not None, it will return a result of addmm(). Code is here.
Why do we remove that logic here?
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 can leave this to downstream optimization to keep the graph as simple and expressive as possible. What do you think?
Also addmm is an aten op. I think we should avoid calling other ATen ops and instead extract logic to common functions only when needed (which for now is not well supported by onnxscript, so we don’t call other functions ever yet)
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.
For the optimization purpose, then I think we should add some comments here to mark this point so that we won't forget it when we start the optimization work.
Even these functions were named with an aten_ prefix, they are still ONNXScript functions which are essentially same to those op.Functions. I think we don't need to avoid calling each other within this aten functions lib. Do you have any examples/ideas to describe the cons?
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.
(1) Since they have ATen signatures, we have seen many cases where additional params need to be provided to make the call correct. (2) Conceptually, the ATen functions interface with ATen ops (external facing). And so calling them internally overloads the responsibility, which I hope to maintain a clear conceptual model/boundary of.
This also helps with the representation of the exported graph. When users see an ATen function, they will know there is a corresponding op in their model.
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.
Added a comment
[ghstack-poisoned]
[ghstack-poisoned]
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!
[ghstack-poisoned]
[ghstack-poisoned]
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * #256 * __->__ #255 * #252 A bunch of matmul and math ops
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * __->__ #256 * #255 * #252 Some more math and matrix ops
Stack from ghstack (oldest at bottom):