Skip to content

Commit 2c0f97e

Browse files
committed
Address build error
1 parent 83c313f commit 2c0f97e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

onnxruntime/core/graph/graph.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4344,7 +4344,10 @@ Status Graph::ProcessSubgraphsInmemoryData(ONNX_NAMESPACE::GraphProto& output_gr
43444344
}
43454345
#else
43464346
for (auto& initializer : *output_graph_proto.mutable_initializer()) {
4347-
ORT_RETURN_IF_ERROR(MaybeInlineInitializerData(*this, initializer));
4347+
if (utils::HasExternalDataInMemory(initializer)) {
4348+
// If the initializer has external data in memory, we need to inline it.
4349+
ORT_RETURN_IF_ERROR(InlineOrCopyInitializerToGraphProto(*this, initializer, initializer));
4350+
}
43484351
}
43494352
#endif
43504353
}
@@ -4387,8 +4390,11 @@ ONNX_NAMESPACE::GraphProto Graph::ToGraphProto() const {
43874390
}
43884391
}
43894392
#else
4393+
// Add initializers to parent graph by copy converting them from graph_proto_
4394+
// ToGraphProtoInternal() does not copy initializers for the main graph
4395+
auto* mutable_initializers = result.mutable_initializer();
43904396
for (const auto& initializer : graph_proto_->initializer()) {
4391-
ORT_THROW_IF_ERROR(InlineOrCopyInitializerToGraphProto(*this, initializer, *mutable_initializers));
4397+
ORT_THROW_IF_ERROR(InlineOrCopyInitializerToGraphProto(*this, initializer, *mutable_initializers->Add()));
43924398
}
43934399
#endif
43944400
}

0 commit comments

Comments
 (0)