Skip to content

Commit

Permalink
Fix reporting of unused initializers in subgraphs (#19341)
Browse files Browse the repository at this point in the history
### Description
<!-- Describe your changes. -->
Increment num_resolves_ inside the graph resolve finalization function
so the subgraphs have the same value.

This prevents incorrect output regarding removing unused initializers.

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
#19141
  • Loading branch information
skottmckay authored Jan 31, 2024
1 parent 55b60d8 commit 68b6064
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions onnxruntime/core/graph/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2798,12 +2798,13 @@ Status Graph::Resolve(const ResolveOptions& options) {
graph.GraphProtoSyncNeeded(false);
}

// set num_resolves_ here so the graph and any subgraphs all have the same value
++graph.num_resolves_;

return Status::OK(); };

ORT_RETURN_IF_ERROR(ForThisAndAllSubgraphs(all_subgraphs, finalize_func));

++num_resolves_;

return Status::OK();
}

Expand Down

0 comments on commit 68b6064

Please sign in to comment.