File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments