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_