Make Graph::InlineFunction be able to process initializers (#11443)

This commit is contained in:
Changming Sun 2022-05-05 12:30:29 -07:00 committed by GitHub
parent 8d6ade9e08
commit d2ae0f49b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<TensorProto*> 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_