-
Notifications
You must be signed in to change notification settings - Fork 54
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
A couple of bug fixes #1945
A couple of bug fixes #1945
Conversation
❌ 14 Tests Failed:
View the full list of 3 ❄️ flaky tests
To view more test analytics, go to the Test Analytics Dashboard |
onnxscript/optimizer/_inliner.py
Outdated
|
||
cloner = _CopyReplace(self, attributes, value_map, node.metadata_props, call_stack) | ||
cloner = _CopyReplace(self, attributes, value_map, node.metadata_props, call_stack + [call_site_id]) |
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.
cloner = _CopyReplace(self, attributes, value_map, node.metadata_props, call_stack + [call_site_id]) | |
cloner = _CopyReplace(self, attributes, value_map, node.metadata_props, [*call_stack, call_site_id]) |
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.
Is there a way to suppress/ignore this suggestion from ruff? It doesn't make sense to me. I don't see how the replacement can be more efficient? But it is clearly less readable (my personal opinion).
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 went ahead and changed it so that this can be merged, but it would be good to know if there is a mechanism to override and ignore such a warning. I think efficiency argument might hold true for more complicated concatenations involving more than a single concetnation, but don't see it making a difference in a single concatenation like 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.
To ignore, you can use # noqa: RUF005
or whatever ruff error code it is.
Personally I like the unpack syntax better. It seems clear especially when we are unpacking multiple Sequences. It also make it immediately clear that the argument is a list, instead of the reader having to know that call_stack
is a list and thus list + list
is support. This is also useful when, say, call_stack
is an arbitrary sequence and may not have +
defined and we can use the same syntax without having to ensure call_stack
being a list.
Efficiency wise, this saves an additional list construction on [call_site_id]
, although practically the overhead should be trivial.
Fixes a couple of bugs that show up in GPT2 optimization.