From d2ae0f49b2cd7824613c27df7baa0dfa9559e1db Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Thu, 5 May 2022 12:30:29 -0700 Subject: [PATCH] Make Graph::InlineFunction be able to process initializers (#11443) --- onnxruntime/core/graph/graph.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/onnxruntime/core/graph/graph.cc b/onnxruntime/core/graph/graph.cc index a35b98f943..61ed6ca0cf 100644 --- a/onnxruntime/core/graph/graph.cc +++ b/onnxruntime/core/graph/graph.cc @@ -4014,6 +4014,12 @@ Status Graph::InlineFunction(Node& node) { auto uniq_identifier = ss.str(); const auto& model_path = ModelPath(); + for (auto& init : subgraph.name_to_initial_tensor_) { + const gsl::not_null tensor{graph_proto_->add_initializer()}; + *tensor = *init.second; + tensor->set_name(tensor->name() + uniq_identifier); + name_to_initial_tensor_[tensor->name()] = tensor; + } for (const auto& subgraph_node : subgraph.Nodes()) { if (subgraph_node.OpType() == kConstant) { // Copy constant nodes _value to name_to_initial_tensor_