Skip to content

Commit

Permalink
[VitisAI] graph_save only saves proto of the graph instead of entire …
Browse files Browse the repository at this point in the history
…model (microsoft#17368)

### Description
<!-- Describe your changes. -->
graph_save only saves proto of the graph instead of entire model.


### 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. -->
We would like to export a part of a model as a new model for unit test.
Therefore, we have to change the API to support such need.
  • Loading branch information
BoarQing authored Sep 6, 2023
1 parent 8914fe6 commit 2629cb8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions onnxruntime/core/providers/vitisai/imp/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ void graph_save(const Graph& graph, const std::string& filename, const std::stri
}
}
// use relative path as data storage.
for (auto i = 0; i < model_proto.graph().initializer_size(); ++i) {
auto initializer = model_proto.mutable_graph()->mutable_initializer(i);
auto graph_proto = model_proto.mutable_graph();
*graph_proto = graph.ToGraphProto();
for (auto i = 0; i < graph_proto->initializer_size(); ++i) {
auto initializer = graph_proto->mutable_initializer(i);
for (auto j = 0; j < initializer->external_data_size(); ++j) {
auto external_data = initializer->mutable_external_data(j);
if (external_data->key() == "location") {
Expand Down

0 comments on commit 2629cb8

Please sign in to comment.