opgen: make all OpSchema attributes keyword-only args in Python#773
Merged
opgen: make all OpSchema attributes keyword-only args in Python#773
Conversation
bdd91a3 to
c88a6bd
Compare
Collaborator
|
fyi I am bumping ort and nightly in #770 |
Contributor
Author
|
Yeah, just trying to see if the problem I am seeing on the ort-nightly CI was addressed already. Seems not. |
Contributor
Author
|
Actually I think I'll rebase this for now on your branch so we're on the same page. |
Contributor
Author
|
Nice. Thanks @justinchuby, your branch makes this PR go green. |
justinchuby
approved these changes
Jun 9, 2023
Codecov Report
@@ Coverage Diff @@
## main #773 +/- ##
=======================================
Coverage 75.86% 75.86%
=======================================
Files 113 113
Lines 13200 13200
Branches 1305 1305
=======================================
Hits 10014 10014
Misses 2866 2866
Partials 320 320
|
gramalingam
reviewed
Jun 15, 2023
gramalingam
reviewed
Jun 15, 2023
gramalingam
approved these changes
Jun 15, 2023
By explicitly projecting all OpSchema attributes to keyword-only arguments in Python, we do not need to reorder attributes based on whether or not they have default values. This allows the Python API to express the same ordering as the op itself for inputs and attributes.
With ONNX attributes now expressed as keyword-only arguments, we do not need to appease Python with setting a default value on these kwargs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By explicitly projecting all OpSchema attributes to keyword-only arguments in Python, we do not need to reorder attributes based on whether or not they have default values. This allows the Python API to express the same ordering as the op itself for inputs and attributes.
This also makes attribute specification consistent with variadic input ops which already have that implicit requirement.