Skip to content
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

Don't create implicit input for outer scope value if there is a subgraph input with the same name. #1186

Merged

Conversation

skottmckay
Copy link
Contributor

@skottmckay skottmckay commented Jun 7, 2019

If there is an outer scope value that matches a subgraph input, don't create an implicit input from the outer scope value. Doing so leads to both being in scope when executing the subgraph which is incorrect. onnx/onnx#2082

Minor unrelated change for issue noticed while debugging: Use unordered_set for implicit inputs so we don't add them multiple times.

… create an implicit input from the outer scope value.

Minor unrelated change for issue noticed while debugging: Use unordered_set for implicit inputs so we don't add them multiple times.
@skottmckay skottmckay requested a review from a team as a code owner June 7, 2019 01:20
@skottmckay skottmckay requested a review from gramalingam July 31, 2019 05:17
@skottmckay skottmckay assigned skottmckay and unassigned gramalingam Jul 31, 2019
if (outer_scope_node_args.find(input_arg_name) != outer_scope_node_args.cend()) {
// if it matches an outer scope value make sure it's not also a graph input or initializer
// as the ONNX checker currently allows a graph input to shadow an outer scope value
if (resolve_context_.inputs_and_initializers.find(input_arg_name) ==
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: Conceptually, this belongs together with the search in line 991 (search the locally-defined names, which is the union of output_args and inputs and initializers). While it has the same effect, it might be a bit easier to understand if we move this check up there (basically swapping the two checks in 999 and 1002 around).

gramalingam
gramalingam previously approved these changes Aug 1, 2019
@skottmckay skottmckay merged commit 9fb8867 into master Aug 1, 2019
@skottmckay skottmckay deleted the skottmckay/FixSubgraphInputNotShadowingOuterScopeValue branch August 1, 2019 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants