Skip to content

Update the GraphProto for subgraphs when saving the Graph. - #647

Merged
Scott McKay (skottmckay) merged 7 commits into
masterfrom
skottmckay/UpdateSubgraphsWhenSavingGraph
Oct 23, 2019
Merged

Update the GraphProto for subgraphs when saving the Graph. #647
Scott McKay (skottmckay) merged 7 commits into
masterfrom
skottmckay/UpdateSubgraphsWhenSavingGraph

Conversation

@skottmckay

Copy link
Copy Markdown
Contributor

This is required to produce a valid overall Graph if the Graph has been optimized. If the GraphProto attribute are not updated
a) the optimizations will be lost from any subgraphs
b) implicit inputs to the subgraphs may be broken by changes to nodes in the parent graph

@skottmckay
Scott McKay (skottmckay) requested a review from a team as a code owner March 18, 2019 09:38
Comment thread onnxruntime/core/graph/graph.cc Outdated
Comment thread onnxruntime/core/graph/graph.cc Outdated
if (update_subgraphs && attribute.second.has_g()) {
// partitioning or optimization may have changed the subgraph, so the original GraphProto may not be valid.
// call ToGraphProto to get the current info and use this for the attribute
const auto& latest = attr_to_subgraph_map_.find(attribute.first)->second->ToGraphProto();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we know when the subgraph proto needs re-building, so that we avoid it otherwise?

@skottmckay Scott McKay (skottmckay) Jul 29, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ToGraphProto only rebuilds if it has to. If there have been no changes it will return the currrent GraphProto instead of creating a new one.

@yuslepukhin
Dmitri Smirnov (yuslepukhin) deleted the skottmckay/UpdateSubgraphsWhenSavingGraph branch August 6, 2019 17:03
@yuslepukhin
Dmitri Smirnov (yuslepukhin) restored the skottmckay/UpdateSubgraphsWhenSavingGraph branch August 6, 2019 17:14

@ke1337 Ke Deng (ke1337) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@skottmckay
Scott McKay (skottmckay) merged commit 41d55ea into master Oct 23, 2019
@skottmckay
Scott McKay (skottmckay) deleted the skottmckay/UpdateSubgraphsWhenSavingGraph branch October 24, 2019 20:33
Jaskaran Singh Nagi (jnagi-intel) pushed a commit to jnagi-intel/onnxruntime that referenced this pull request Jan 5, 2026
* Fix the LUID check

* Address review comments
Dmitri Smirnov (yuslepukhin) pushed a commit that referenced this pull request Mar 17, 2026
## Describe your changes

Copy DistributedOnnxModel generated models to output folder.

## Checklist before requesting a review
- [ ] Add unit tests for this change.
- [ ] Make sure all tests can pass.
- [ ] Update documents if necessary.
- [x] Format your code by running `pre-commit run --all-files`
- [ ] Is this a user-facing change? If yes, give a description of this
change to be included in the release notes.

## (Optional) Issue link
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.

6 participants